Fix bspatch heap overflow vulnerability.

Obtained from:	Chromium
Reported by:	Lu Tung-Pin
Security:	FreeBSD-SA-16:25.bspatch
This commit is contained in:
delphij 2016-07-25 14:45:48 +00:00
parent fb5bb38272
commit 0feb844f8c

View File

@ -163,6 +163,10 @@ int main(int argc,char * argv[])
ctrl[i]=offtin(buf);
}
/* Sanity-check */
if ((ctrl[0] < 0) || (ctrl[1] < 0))
errx(1,"Corrupt patch\n");
/* Sanity-check */
if(newpos+ctrl[0]>newsize)
errx(1,"Corrupt patch\n");