libxc: check blob size before proceeding in xc_dom_check_gzip

This is part of the fix to a security issue, XSA-55.

Signed-off-by: Matthew Daley <mattjd@gmail.com>
This commit is contained in:
Matthew Daley authored and Ian Jackson committed 2013-06-14 16:45:41 +01:00
1 parent 6eca85d5c1
commit ac63ddd70a
1 file changed
+5
+5
View File
@@ -284,6 +284,11 @@ size_t xc_dom_check_gzip(xc_interface *xch, void *blob, size_t ziplen)
unsigned char *gzlen;
size_t unziplen;
if ( ziplen < 6 )
/* Too small. We need (i.e. the subsequent code relies on)
* 2 bytes for the magic number plus 4 bytes length. */
return 0;
if ( strncmp(blob, "\037\213", 2) )
/* not gzipped */
return 0;
Reference in new issue
Block a user
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.