Browse code

s/strdup/cli_strdup/g

git-svn-id: file:///var/lib/svn/clamav-devel/trunk/clamav-devel@2662 77e5149b-7576-45b1-b177-96237e5ba77b

Tomasz Kojm authored on 2007/02/01 03:13:17
Showing 6 changed files
... ...
@@ -458,7 +458,7 @@ static int read_chunk_entries(unsigned char *chunk, uint32_t chunk_len,
458 458
 		}
459 459
 		if (name_len > 0xFFFFFF) {
460 460
 			cli_dbgmsg("CHM file name too long: %llu\n", name_len);
461
-			file_e->name = (unsigned char *) strdup("truncated");
461
+			file_e->name = (unsigned char *) cli_strdup("truncated");
462 462
 	                if (!file_e->name) {
463 463
         	                free(file_e);
464 464
                 	        return FALSE;
... ...
@@ -292,7 +292,7 @@ static void html_tag_arg_set(tag_arguments_t *tags, char *tag, char *value)
292 292
 	for (i=0; i < tags->count; i++) {
293 293
 		if (strcmp(tags->tag[i], tag) == 0) {
294 294
 			free(tags->value[i]);
295
-			tags->value[i] = strdup(value);
295
+			tags->value[i] = cli_strdup(value);
296 296
 			return;
297 297
 		}
298 298
 	}
... ...
@@ -323,16 +323,16 @@ static void html_tag_arg_add(tag_arguments_t *tags,
323 323
 		tags->contents[tags->count-1]=NULL;
324 324
 	}
325 325
 #endif
326
-	tags->tag[tags->count-1] = strdup(tag);
326
+	tags->tag[tags->count-1] = cli_strdup(tag);
327 327
 	if (value) {
328 328
 		if (*value == '"') {
329
-			tags->value[tags->count-1] = strdup(value+1);
329
+			tags->value[tags->count-1] = cli_strdup(value+1);
330 330
 			len = strlen(value+1);
331 331
 			if (len > 0) {
332 332
 				tags->value[tags->count-1][len-1] = '\0';
333 333
 			}
334 334
 		} else {
335
-			tags->value[tags->count-1] = strdup(value);
335
+			tags->value[tags->count-1] = cli_strdup(value);
336 336
 		}
337 337
 	} else {
338 338
 		tags->value[tags->count-1] = NULL;
... ...
@@ -1041,7 +1041,7 @@ static int cli_html_normalise(int fd, m_area_t *m_area, const char *dirname, tag
1041 1041
 						if (arg_action_value) {
1042 1042
 							if(in_form_action) 
1043 1043
 								free(in_form_action);							
1044
-							in_form_action = strdup(arg_action_value);
1044
+							in_form_action = cli_strdup(arg_action_value);
1045 1045
 						}
1046 1046
 #endif
1047 1047
 					} else if (strcmp(tag, "img") == 0) {
... ...
@@ -109,7 +109,7 @@ static int cli_ac_addsig(struct cli_matcher *root, const char *virname, const ch
109 109
     if(strchr(hexsig, '(')) {
110 110
 	    char *hexcpy, *hexnew, *start, *h, *c;
111 111
 
112
-	if(!(hexcpy = strdup(hexsig))) {
112
+	if(!(hexcpy = cli_strdup(hexsig))) {
113 113
 	    if(new->offset)
114 114
 		free(new->offset);
115 115
 	    free(new);
... ...
@@ -316,7 +316,7 @@ int cli_parse_add(struct cli_matcher *root, const char *virname, const char *hex
316 316
 
317 317
 	root->ac_partsigs++;
318 318
 
319
-	if(!(hexcpy = strdup(hexsig)))
319
+	if(!(hexcpy = cli_strdup(hexsig)))
320 320
 	    return CL_EMEM;
321 321
 
322 322
 	len = strlen(hexsig);
... ...
@@ -466,12 +466,14 @@ int cli_parse_add(struct cli_matcher *root, const char *virname, const char *hex
466 466
 
467 467
 	strncpy(bm_new->virname, virname, virlen);
468 468
 
469
-	bm_new->offset = strdup(offset);
470
-	if(!bm_new->offset) {
471
-	    free(bm_new->pattern);
472
-	    free(bm_new->virname);
473
-	    free(bm_new);
474
-	    return CL_EMEM;
469
+	if(offset) {
470
+	    bm_new->offset = cli_strdup(offset);
471
+	    if(!bm_new->offset) {
472
+		free(bm_new->pattern);
473
+		free(bm_new->virname);
474
+		free(bm_new);
475
+		return CL_EMEM;
476
+	    }
475 477
 	}
476 478
 
477 479
 	bm_new->target = target;
... ...
@@ -1389,7 +1391,7 @@ int cl_statinidir(const char *dirname, struct cl_stat *dbstat)
1389 1389
 	dbstat->entries = 0;
1390 1390
 	dbstat->stattab = NULL;
1391 1391
 	dbstat->statdname = NULL;
1392
-	dbstat->dir = strdup(dirname);
1392
+	dbstat->dir = cli_strdup(dirname);
1393 1393
     } else {
1394 1394
         cli_errmsg("cl_statdbdir(): Null argument passed.\n");
1395 1395
 	return CL_ENULLARG;
... ...
@@ -211,7 +211,7 @@ static int sis_extract_simple(int fd, char *mfile, uint32_t length, uint32_t off
211 211
 	    return CL_EMEM;
212 212
 	sprintf(subdir, "%s/%s", dir, typedir);
213 213
     } else {
214
-	if(!(subdir = strdup(dir)))
214
+	if(!(subdir = cli_strdup(dir)))
215 215
 	    return CL_EMEM;
216 216
     }
217 217
 
... ...
@@ -1557,7 +1557,7 @@ int cli_unrar_extract_next_prepare(rar_state_t* state,const char* dirname)
1557 1557
 		new_metadata->unpack_size = state->file_header->high_unpack_size * 0x100000000 + state->file_header->unpack_size;
1558 1558
 		new_metadata->crc = state->file_header->file_crc;
1559 1559
 		new_metadata->method = state->file_header->method;
1560
-		new_metadata->filename = strdup(state->file_header->filename);
1560
+		new_metadata->filename = cli_strdup(state->file_header->filename);
1561 1561
 		new_metadata->next = NULL;
1562 1562
 		new_metadata->encrypted = FALSE;
1563 1563
 	if (state->metadata_tail == NULL) {
... ...
@@ -462,7 +462,7 @@ vba_project_t *vba56_dir_read(const char *dir)
462 462
 		close(fd);
463 463
 		return NULL;
464 464
 	}
465
-	vba_project->dir = strdup(dir);
465
+	vba_project->dir = cli_strdup(dir);
466 466
 	vba_project->offset = (uint32_t *) cli_malloc (sizeof(uint32_t) *
467 467
 					record_count);
468 468
 	if (!vba_project->offset) {
... ...
@@ -1387,7 +1387,7 @@ static macro_extnames_t *wm_read_macro_extnames(int fd)
1387 1387
 				get_unicode_name(name_tmp, macro_extname->length*2, FALSE);
1388 1388
 			    free(name_tmp);
1389 1389
 			} else {
1390
-			    macro_extname->extname = strdup("[no name]");
1390
+			    macro_extname->extname = cli_strdup("[no name]");
1391 1391
 			    macro_extname->length = 10;
1392 1392
 			}
1393 1393
 		} else {
... ...
@@ -1408,7 +1408,7 @@ static macro_extnames_t *wm_read_macro_extnames(int fd)
1408 1408
 			    }
1409 1409
 			    macro_extname->extname[macro_extname->length] = '\0';
1410 1410
 			} else {
1411
-			    macro_extname->extname = strdup("[no name]");
1411
+			    macro_extname->extname = cli_strdup("[no name]");
1412 1412
 			    macro_extname->length = 10;
1413 1413
 			}
1414 1414
 		}
... ...
@@ -1635,7 +1635,7 @@ vba_project_t *wm_dir_read(const char *dir)
1635 1635
 			vba_project = NULL;
1636 1636
 			goto abort;
1637 1637
 		}
1638
-		vba_project->dir = strdup(dir);
1638
+		vba_project->dir = cli_strdup(dir);
1639 1639
 		vba_project->offset = (uint32_t *) cli_malloc(sizeof(uint32_t) *
1640 1640
 					macro_info->count);
1641 1641
 		if (!vba_project->offset) {
... ...
@@ -1668,7 +1668,7 @@ vba_project_t *wm_dir_read(const char *dir)
1668 1668
 		}
1669 1669
 		vba_project->count = macro_info->count;
1670 1670
 		for (i=0 ; i < macro_info->count ; i++) {
1671
-			vba_project->name[i] = strdup("WordDocument");
1671
+			vba_project->name[i] = cli_strdup("WordDocument");
1672 1672
 			vba_project->offset[i] = macro_info->macro_entry[i].offset;
1673 1673
 			vba_project->length[i] = macro_info->macro_entry[i].len;
1674 1674
 			vba_project->key[i] = macro_info->macro_entry[i].key;