- 1
board.moveBuffer[index++].moveInt = move.moveInt;Нашли или выдавили из себя код, который нельзя назвать нормальным, на который без улыбки не взглянешь? Не торопитесь его удалять или рефакторить, — запостите его на говнокод.ру, посмеёмся вместе!
−46
board.moveBuffer[index++].moveInt = move.moveInt;
            Вырвал из контекста.
board и move - глобальные переменные.
index - единственный параметр в монолитной функции длиной в 500 строк (я не преувеличиваю).
        
−42
int main(int argc, char *argv[]) 
{ 
int  i = 0; 
char stuffing[36]; 
for (i = 0; i <= 32; i += 4) 
*(long *) &stuffing = 0x8048374 ;  
puts(stuffing);	
return 0; 
}
            Имея какую-либо прогу с принтфами и сканфами. имея уязвимости этих функций, мы с помощью программы, скомпилированной с этим кодом, произведем атаку на адрес 0x8048374. по этому адресу в программе - оппоненте находится точка входа в функцию, где происходит ввод строки(scanf'ом). введя строку, программа-атакер не даст выйти из функции и снова ударит по адресу входа и так далее....зацикливание. 
Это лаба по анализу уязвимостей по. вот не пойму только - 8 раз пройдет цикл, и по идее должен завершиться код, но помню когда делал лабу - сканф вызывался бесконечно при атаке. еще ужасная 7я строка создает жуткое впечатление ничегонепонимания )
        
−47
void init_by_array64(unsigned long long init_key[],
		     unsigned long long key_length)
{
    unsigned long long i, j, k;
    init_genrand64(19650218ULL);
    i=1; j=0;
    k = (NN>key_length ? NN : key_length);
    for (; k; k--) {
        mt[i] = (mt[i] ^ ((mt[i-1] ^ (mt[i-1] >> 62)) * 3935559000370003845ULL))
          + init_key[j] + j; /* non linear */
        i++; j++;
        if (i>=NN) { mt[0] = mt[NN-1]; i=1; }
        if (j>=key_length) j=0;
    }
    for (k=NN-1; k; k--) {
        mt[i] = (mt[i] ^ ((mt[i-1] ^ (mt[i-1] >> 62)) * 2862933555777941757ULL))
          - i; /* non linear */
        i++;
        if (i>=NN) { mt[0] = mt[NN-1]; i=1; }
    }
    mt[0] = 1ULL << 63; /* MSB is 1; assuring non-zero initial array */ 
}"Чистый и ясный код" (с)
−45
#include <iostream>
#include <conio.h>
 
using namespace std;
 
void iswap(int &n1, int &n2)
{
    int temp = n1;
    n1 = n2;
    n2 = temp;
}
 
int main()
{
    int const n = 100;
    int a[n];
    for ( int i = 0; i < n; ++i ) { a[i] = n - i; cout << a[i] << " "; }
        //заполняем массив для наглядности.
        //-----------сортировка------------// 
        //сортирует по-возрастанию. чтобы настроить по-убыванию, 
        //поменяйте знаки сравнения в строчках, помеченных /*(знак)*/
    int sh = 0; //смещение
    bool b = false;
    for(;;)
    {
        b = false;
        for ( int i = 0; i < n; i++ )
        {
            if( i * 2 + 2 + sh < n )
            {
                if( ( a[i + sh] > /*<*/ a[i * 2 + 1 + sh] ) || ( a[i + sh] > /*<*/ a[i * 2 + 2 + sh] ) )
                {
                    if ( a[i * 2 + 1 + sh] < /*>*/ a[i * 2 + 2 + sh] ) 
                    {
                        iswap( a[i + sh], a[i * 2 + 1 + sh] );
                        b = true;
                    }
                    else if ( a[i * 2 + 2 + sh] < /*>*/ a[ i * 2 + 1 + sh]) 
                         {
                             iswap( a[ i + sh], a[i * 2 + 2 + sh]);
                             b = true;
                         }
                }
            }
            else if( i * 2 + 1 + sh < n )
                 {
                     if( a[i + sh] > /*<*/ a[ i * 2 + 1 + sh] )
                     {
                         iswap( a[i + sh], a[i * 2 + 1 + sh] );
                         b = true;
                     }
                 }
        }
        if (!b) sh++; //смещение увеличивается, когда на текущем этапе 
                      //сортировать больше нечего
        if ( sh + 2 == n ) break; 
    }  //конец сортировки
 
 
    cout << endl << endl;
    for ( int i = 0; i < n; ++i ) cout << a[i] << " "; 
 
 
    _getch();
    return 0;
}Запостил как-то на вики как более короткая реализация с++, более понятная и главное - рабочая. Не признали. Сам смотрю - не понимаю че там написано )))
−40
#include <stdio.h>
#include <unistd.h> 
#include <stdlib.h> 
#include <string.h>
#include <iostream>
#include <string>
using namespace std;
static char ifnm[100];
string *tags = new string [100];
int tags_init(string stag[]){
  int i=0;
  stag[i++]="root";
  stag[i++]="word";
  stag[i++]="english";
  stag[i++]="russian";
  stag[i++]="russian2";
//  stag[i++]="id";
  return i;
};
int main(int argc,char *argv[]){
FILE *fp;
if(argc=0){printf("No file name\n");exit(0);}
strcpy(ifnm,argv[1]);
fp = fopen(ifnm, "r");
if (fp == NULL)exit(-1);
  //Error;
char str[180];
int tn=tags_init(tags);
cout<<"<"<<tags[0]<<">"<<endl;
while(fgets(str, 180,fp))
{
  fgets(str,180, fp);
  //cout<<str<<endl;
  char *pname;
    pname = strtok (str,"-");
    int ti=0;
    cout<<"<"<<tags[1]<<">"<<endl;
    ti=1;
  while (pname != NULL && ti<=tn)
  {
    ti++;
    cout<<"<"<<tags[ti]<<">"<<endl;
    printf ("\t%s\n",pname);
    cout<<"</"<<tags[ti]<<">"<<endl;
    pname = strtok (NULL, "-");
  }
cout<<"</"<<tags[1]<<">"<<endl;
}
cout<<"</"<<tags[0]<<">"<<endl;
fclose(fp);
}Преобразует текстовый файл в xml формат
−40
*newСамая соль.
−36
//установка режима реализма
		void includeRealTimeMode()
		{
			TSerialCommand^ command = gcnew TSerialCommand;
			command->cmd = CMD_CONTROL;
			command->sc1 = SC_REAL_TIME_MODE;
			command->sc2 = NULL; //_portManager.oscillFrequency;
			_portManager.sendCommand(command);
		}
            Команда включает (активирует) режим реального времени.
C++\CLI
        
−30
TTime childStartTime(TDateTime(2006, EJanuary, 8, 14, 0, 0, 0)); // January 9th 2pmИз примера calexample в symbian sdk.
−35
// For the probably_koi8_locales we have to look. the standard says
// these are 8859-5, but almost all Russian users use KOI8-R and
// incorrectly set $LANG to ru_RU. We'll check tolower() to see what
// it thinks ru_RU means.
// If you read the history, it seems that many Russians blame ISO and
// Perestroika for the confusion.
...
static QTextCodec * ru_RU_hack(const char * i) {
    QTextCodec * ru_RU_codec = 0;
#if !defined(QT_NO_SETLOCALE)
    QByteArray origlocale(setlocale(LC_CTYPE, i));
#else
    QByteArray origlocale(i);
#endif
    // unicode   koi8r   latin5   name
    // 0x044E    0xC0    0xEE     CYRILLIC SMALL LETTER YU
    // 0x042E    0xE0    0xCE     CYRILLIC CAPITAL LETTER YU
    int latin5 = tolower(0xCE);
    int koi8r = tolower(0xE0);
    if (koi8r == 0xC0 && latin5 != 0xEE) {
        ru_RU_codec = QTextCodec::codecForName("KOI8-R");
    } else if (koi8r != 0xC0 && latin5 == 0xEE) {
        ru_RU_codec = QTextCodec::codecForName("ISO 8859-5");
    } else {
        // something else again... let's assume... *throws dice*
        ru_RU_codec = QTextCodec::codecForName("KOI8-R");
        qWarning("QTextCodec: Using KOI8-R, probe failed (%02x %02x %s)",
                  koi8r, latin5, i);
    }
#if !defined(QT_NO_SETLOCALE)
    setlocale(LC_CTYPE, origlocale);
#endif
    return ru_RU_codec;
}Снова Qt. На этот раз src/corelib/codecs/qtextcodec.cpp и борьба бобра с ослом русских с буржуинскими стандартами ISO.
−55
void f(int...)
{
};
            Компилится.
http://ideone.com/yPgoq