git-svn-id: file:///var/lib/svn/clamav-devel/trunk/clamav-devel@830 77e5149b-7576-45b1-b177-96237e5ba77b
Tomasz Kojm authored on 2004/09/06 01:18:45... | ... |
@@ -1,3 +1,7 @@ |
1 |
+Sun Sep 5 18:16:13 CEST 2004 (tk) |
|
2 |
+---------------------------------- |
|
3 |
+ * libclamav/pe.c: fix pointer arithmetic in FSG block (bug reported by Nigel) |
|
4 |
+ |
|
1 | 5 |
Sun Sep 5 01:43:31 CEST 2004 (tk) |
2 | 6 |
---------------------------------- |
3 | 7 |
* libclamav/cvd.c: display warning if engine is outdated |
... | ... |
@@ -155,8 +155,8 @@ int cli_scanpe(int desc, const char **virname, long int *scanned, const struct c |
155 | 155 |
char sname[9], buff[256], *tempfile; |
156 | 156 |
int i, found, upx_success = 0, min = 0, max = 0, ret; |
157 | 157 |
int (*upxfn)(char *, int , char *, int) = NULL; |
158 |
- char *src, *dest; |
|
159 |
- int ssize, dsize, ndesc; |
|
158 |
+ char *src = NULL, *dest = NULL; |
|
159 |
+ int ssize = -1, dsize = -1, ndesc; |
|
160 | 160 |
|
161 | 161 |
|
162 | 162 |
if(read(desc, &e_magic, sizeof(e_magic)) != sizeof(e_magic)) { |
... | ... |
@@ -455,7 +455,7 @@ int cli_scanpe(int desc, const char **virname, long int *scanned, const struct c |
455 | 455 |
return CL_EIO; |
456 | 456 |
} |
457 | 457 |
|
458 |
- if((dest = src + newedx - EC32(section_hdr[i + 1].VirtualAddress)) < src || dest >= src + EC32(section_hdr[i + 1].VirtualAddress) + EC32(section_hdr[i + 1].SizeOfRawData) - 4) { |
|
458 |
+ if((newedx - EC32(section_hdr[i + 1].VirtualAddress)) < 0 || ((dest = src + newedx - EC32(section_hdr[i + 1].VirtualAddress)) < src && dest >= src + EC32(section_hdr[i + 1].VirtualAddress) + EC32(section_hdr[i + 1].SizeOfRawData) - 4)) { |
|
459 | 459 |
cli_dbgmsg("FSG: New ESP out of bounds\n"); |
460 | 460 |
free(src); |
461 | 461 |
break; |
... | ... |
@@ -545,7 +545,7 @@ int cli_scanpe(int desc, const char **virname, long int *scanned, const struct c |
545 | 545 |
} |
546 | 546 |
|
547 | 547 |
if((gp = cli_readint32(buff + 1) - EC32(optional_hdr.ImageBase)) >= EC32(section_hdr[i + 1].PointerToRawData) || gp < 0) { |
548 |
- cli_dbgmsg("FSG: Support data out of padding area (newedi: %d, vaddr: %d)\n", newedi, EC32(section_hdr[i].VirtualAddress)); |
|
548 |
+ cli_dbgmsg("FSG: Support data out of padding area (vaddr: %d)\n", EC32(section_hdr[i].VirtualAddress)); |
|
549 | 549 |
break; |
550 | 550 |
} |
551 | 551 |
|