74 |
/* This doesn't have buffer overflow vulnerabilities, because |
/* This doesn't have buffer overflow vulnerabilities, because |
75 |
we always allocate for enough space before appending. */ |
we always allocate for enough space before appending. */ |
76 |
if (!dest) { |
if (!dest) { |
77 |
newloc = malloc(strlen(s))+1; |
newloc = (char *) malloc(strlen(s))+1; |
78 |
strcpy(newloc, s); |
strcpy(newloc, s); |
79 |
return newloc; |
return newloc; |
80 |
} |
} |
81 |
newlen = strlen(dest) + strlen(s) + 1; |
newlen = strlen(dest) + strlen(s) + 1; |
82 |
/* newloc = realloc(dest, newlen); */ |
newloc = (char *) malloc(newlen); |
|
newloc = malloc(newlen); |
|
83 |
strcpy(newloc, dest); |
strcpy(newloc, dest); |
84 |
if (!newloc) return dest; /* Can't do it, throw away the data */ |
if (!newloc) return dest; /* Can't do it, throw away the data */ |
85 |
strcat(newloc, s); |
strcat(newloc, s); |