Browse code

fix possible crash

git-svn: trunk@1453

Trog authored on 2005/04/05 22:28:27
Showing 2 changed files
... ...
@@ -1,3 +1,7 @@
1
+Tue Apr  5 14:27:32 BST 2005 (trog)
2
+-----------------------------------
3
+  * libclamav/vba_extract.c: fix possible crash
4
+
1 5
 Sat Apr  2 22:19:12 BST 2005 (njh)
2 6
 ----------------------------------
3 7
   * libclamav/tnef.c:	Handle attachments where the data are before the title
... ...
@@ -122,7 +122,7 @@ static char *get_unicode_name(char *name, int size, int is_mac)
122 122
         int i, j;
123 123
         char *newname;
124 124
 
125
-	 if (*name == 0 || size <= 0) {
125
+	if (!name || *name == 0 || size <= 0) {
126 126
                 return NULL;
127 127
         }
128 128
 
... ...
@@ -481,6 +481,10 @@ vba_project_t *vba56_dir_read(const char *dir)
481 481
 			goto out_error;
482 482
 		}
483 483
 		length = vba_endian_convert_16(length, is_mac);
484
+		if (length == 0) {
485
+			cli_dbgmsg("zero name length\n");
486
+			goto out_error;
487
+                }
484 488
 		buff = (unsigned char *) cli_malloc(length);
485 489
 		if (!buff) {
486 490
 			cli_dbgmsg("cli_malloc failed\n");