cli_parseres_special: check size before attempting to allocate. (bb #1506)

git-svn: trunk@4999
This commit is contained in:
Török Edvin 2009-04-01 16:39:55 +00:00
parent 0680321846
commit 646c2a4857
2 changed files with 6 additions and 1 deletions

View file

@ -1,3 +1,8 @@
Wed Apr 1 19:39:12 EEST 2009 (edwin)
-------------------------------------
* libclamav/pe.c: cli_parseres_special: check size before attempting
to allocate. (bb #1506)
Wed Apr 1 14:00:35 CEST 2009 (tk)
----------------------------------
* clamd/session.c: respect TemporaryDirectory in cli_gentempfd()

View file

@ -392,7 +392,7 @@ static void cli_parseres_special(uint32_t base, uint32_t rva, int srcfd, struct
uint32_t isz = cli_readint32(resdir+4);
char *str;
rawaddr = cli_rawaddr(cli_readint32(resdir), exe_sections, nsections, &err, fsize, hdr_size);
if (err || !isz || rawaddr+isz >= fsize) {
if (err || !isz || isz >= fsize || rawaddr+isz >= fsize) {
cli_dbgmsg("cli_parseres_special: invalid resource table entry: %lu + %lu\n",
(unsigned long)rawaddr,
(unsigned long)isz);