Changeset 1251 for cacamoo


Ignore:
Timestamp:
Oct 28, 2006, 10:22:58 AM (14 years ago)
Author:
Jean-Yves Lamoureux
Message:
  • Fixed buffer overflow in replace function (still need to be fixed in a more clever way)
File:
1 edited

Legend:

Unmodified
Added
Removed
  • cacamoo/trunk/src/main.c

    r1250 r1251  
    283283        free(buffer);
    284284
     285    cucul_free_buffer(input_buffer);
     286    cucul_free_buffer(output_buffer);
     287    cucul_free_canvas(canvas);
     288
     289
    285290    return 0;
    286291}
     
    511516    char *c = NULL;
    512517    char *newstr = NULL;
     518    char *orig = str;
    513519
    514520    if(oldpiece==NULL || newpiece==NULL)
    515521        return NULL;
    516522
    517     if ((c = (char *) strstr(str, oldpiece)) == NULL) {
     523    if ((c = (char *) strstr(str, oldpiece)) == NULL)
    518524        return str;
    519     }
    520 
    521     newstr = malloc(1024);
     525
     526
     527    newstr = malloc(8192); // FIXME
    522528
    523529    if(newstr == NULL)
     
    553559    strcpy(newstr+newstr_index, str+str_index);
    554560
     561    str = orig;
    555562    return newstr;
    556563}
Note: See TracChangeset for help on using the changeset viewer.