Fix bspatch heap overflow vulnerability.

Obtained from:	Chromium
Reported by:	Lu Tung-Pin
Security:	FreeBSD-SA-16:25.bspatch
This commit is contained in:
Xin LI 2016-07-25 14:45:48 +00:00
parent ae1b731b5d
commit 2c8d04d022

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");