git-svn: trunk@2880
Tomasz Kojm authored on 2007/03/01 10:27:43... | ... |
@@ -228,7 +228,7 @@ int scanmanager(const struct optstruct *opt) |
228 | 228 |
char *cpy, *ptr; |
229 | 229 |
ptr = opt_arg(opt, "max-space"); |
230 | 230 |
if(tolower(ptr[strlen(ptr) - 1]) == 'm') { |
231 |
- cpy = malloc(strlen(ptr)); |
|
231 |
+ cpy = calloc(strlen(ptr), 1); |
|
232 | 232 |
strncpy(cpy, ptr, strlen(ptr) - 1); |
233 | 233 |
limits.maxfilesize = atoi(cpy) * 1024 * 1024; |
234 | 234 |
free(cpy); |
... | ... |
@@ -433,7 +433,7 @@ static int clamav_unpack(const char *prog, char **args, const char *tmpdir, cons |
433 | 433 |
char *cpy, *ptr; |
434 | 434 |
ptr = opt_arg(opt, "max-space"); |
435 | 435 |
if(tolower(ptr[strlen(ptr) - 1]) == 'm') { /* megabytes */ |
436 |
- cpy = malloc(strlen(ptr)); |
|
436 |
+ cpy = calloc(strlen(ptr), 1); |
|
437 | 437 |
strncpy(cpy, ptr, strlen(ptr) - 1); |
438 | 438 |
maxspace = atoi(cpy) * 1024; |
439 | 439 |
free(cpy); |
... | ... |
@@ -285,7 +285,7 @@ struct cfgstruct *getcfg(const char *cfgfile, int verbose) |
285 | 285 |
} |
286 | 286 |
ctype = tolower(arg[strlen(arg) - 1]); |
287 | 287 |
if(ctype == 'm' || ctype == 'k') { |
288 |
- char *cpy = (char *) malloc(strlen(arg)); |
|
288 |
+ char *cpy = (char *) calloc(strlen(arg), 1); |
|
289 | 289 |
strncpy(cpy, arg, strlen(arg) - 1); |
290 | 290 |
if(!isnumb(cpy)) { |
291 | 291 |
if(verbose) |
... | ... |
@@ -192,7 +192,7 @@ int logg(const char *str, ...) |
192 | 192 |
if(logg_time && ((*str != '*') || logg_verbose)) { |
193 | 193 |
time(&currtime); |
194 | 194 |
pt = ctime(&currtime); |
195 |
- timestr = malloc(strlen(pt)); |
|
195 |
+ timestr = calloc(strlen(pt), 1); |
|
196 | 196 |
strncpy(timestr, pt, strlen(pt) - 1); |
197 | 197 |
fprintf(logg_fd, "%s -> ", timestr); |
198 | 198 |
free(timestr); |