LINUX.ORG.RU

История изменений

Исправление vodz, (текущая версия) :

char *kode = (char *) malloc(1);

char *kode = NULL; size_t buf_sz = 0;

kode = (char *) malloc(strlen(kode) + strlen(buf));
strcat(kode, buf);

kode = realloc(kode, buf_sz + stat + 1);
if(kode == NULL)
    err_sys("Memory exchausted");
memcpy(kode + buf_sz, buf, stat);
kode[buf_sz += stat] = '\0';

Исправление vodz, :

char *kode = (char *) malloc(1);

char *kode = NULL; size_t buf_sz = 0;

kode = (char *) malloc(strlen(kode) + strlen(buf));
strcat(kode, buf);

kode = realloc(kode, buf_sz + stat + 1);
if(kode == NULL)
    err_sys("Memory exchausted");
memcpy(kode + buf_sz, buf, stat);
buf_sz += stat;
kode[buf_sz] = '\0';

Исправление vodz, :

char *kode = (char *) malloc(1);

char *kode = NULL; size_t buf_sz = 0;

kode = (char *) malloc(strlen(kode) + strlen(buf));
strcat(kode, buf);

kode = realloc(kode, buf_sz + stat + 1);
if(kode == NULL)
    err_sys("Memory exchausted");
memcpy(kode + buf_sz, buf, stat);
buf_sz += start;
kode[buf_sz] = '\0';

Исходная версия vodz, :

char *kode = (char *) malloc(1);

char *kode = NULL; size_t buf_sz = 0;

kode = (char *) malloc(strlen(kode) + strlen(buf));
strcat(kode, buf);

kode = realloc(kode, buf_sz + stat + 1);
if(kode == NULL)
    err_sys("Memory exchausted");
memcpy(kode + buf_sz, buf);
buf_sz += start;
kode[buf_sz] = '\0';