Browse code

add sanity check to pefromupx()

git-svn: trunk@1496

Tomasz Kojm authored on 2005/04/28 06:56:19
Showing 2 changed files
... ...
@@ -1,3 +1,7 @@
1
+Wed Apr 27 23:54:46 CEST 2005 (tk)
2
+----------------------------------
3
+  * libclamav/upx.c: add sanity check to pefromupx()
4
+
1 5
 Tue Apr 26 19:37:24 CEST 2005 (tk)
2 6
 ----------------------------------
3 7
   * libclamav/readdb.c: improve parsing of broken signatures (bug reported by
... ...
@@ -76,6 +76,9 @@ int pefromupx (char *src, char *dst, int *dsize, uint32_t ep, uint32_t upx0, uin
76 76
   int sectcnt, upd=1, realstuffsz;
77 77
   int foffset=0xd0+0xf8;
78 78
 
79
+  if((dst == NULL) || (src == NULL))
80
+    return 0;
81
+
79 82
   imports = dst + cli_readint32(src + ep - upx1 + magic);
80 83
 
81 84
   realstuffsz = imports-dst;