Browse code

fix possible buffer overflow

git-svn: trunk@1722

Tomasz Kojm authored on 2005/09/16 23:49:29
Showing 2 changed files
... ...
@@ -1,3 +1,7 @@
1
+Fri Sep 16 16:49:14 CEST 2005 (tk)
2
+----------------------------------
3
+  * libclamav/upx.c: fix possible buffer overflow (acab)
4
+
1 5
 Fri Sep 16 16:39:37 CEST 2005 (tk)
2 6
 ----------------------------------
3 7
   * libclamav/fsg.c: fix possible infinite loop (acab)
... ...
@@ -117,7 +117,7 @@ int pefromupx (char *src, char *dst, int *dsize, uint32_t ep, uint32_t upx0, uin
117 117
   }
118 118
   
119 119
   sections = pehdr+0xf8;
120
-  if ( ! (sectcnt = pehdr[6]+256*pehdr[7])) {
120
+  if ( ! (sectcnt = (unsigned char)pehdr[6]+256*(unsigned char)pehdr[7])) {
121 121
     cli_dbgmsg("UPX: No sections? - giving up rebuild\n");
122 122
     return 0;
123 123
   }