Browse code

fix error path crash

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

Trog authored on 2004/06/25 23:18:13
Showing 2 changed files
... ...
@@ -1,3 +1,7 @@
1
+Fri Jun 25 15:17:37 BST 2004 (trog)
2
+-----------------------------------
3
+  * libclamav/vba_extract.c: fix error path crash
4
+
1 5
 Fri Jun 25 14:57:06 BST 2004 (njh)
2 6
 ----------------------------------
3 7
   * libclamav/mbox.c:	Optimise the scanning of emails that don't have
... ...
@@ -203,7 +203,11 @@ static int vba_read_project_strings(int fd, int is_mac)
203 203
 			break;
204 204
 		}
205 205
 		name = get_unicode_name(buff, length, is_mac);
206
-		cli_dbgmsg("name: %s\n", name);
206
+		if (name) {
207
+			cli_dbgmsg("name: %s\n", name);
208
+		} else {
209
+			cli_dbgmsg("name: [null]\n");
210
+		}
207 211
 		free(buff);
208 212
 
209 213
 		/* Ignore twelve bytes from entries of type 'G'.
... ...
@@ -478,6 +482,11 @@ vba_project_t *vba56_dir_read(const char *dir)
478 478
 			goto out_error;
479 479
 		}
480 480
 		vba_project->name[i] = get_unicode_name(buff, length, is_mac);
481
+		if (!vba_project->name[i]) {
482
+			offset = lseek(fd, 0, SEEK_CUR);
483
+			vba_project->name[i] = (char *) cli_malloc(18);
484
+			snprintf(vba_project->name[i], 18, "clamav-%.10d", offset);
485
+		}
481 486
 		cli_dbgmsg("project name: %s, ", vba_project->name[i]);
482 487
 		free(buff);
483 488