From: Christos Zoulas Date: Thu, 7 Aug 2014 09:38:35 +0000 (+0000) Subject: Prevent wrap around (Remi Collet at redhat) X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=c398298bc1a9bb064512c715e7f13bcac4ed08e1;p=file Prevent wrap around (Remi Collet at redhat) --- diff --git a/src/cdf.c b/src/cdf.c index 8554329a..99c0d25f 100644 --- a/src/cdf.c +++ b/src/cdf.c @@ -35,7 +35,7 @@ #include "file.h" #ifndef lint -FILE_RCSID("@(#)$File: cdf.c,v 1.64 2014/07/24 19:35:39 christos Exp $") +FILE_RCSID("@(#)$File: cdf.c,v 1.65 2014/08/07 09:38:35 christos Exp $") #endif #include @@ -835,6 +835,10 @@ cdf_read_property_info(const cdf_stream_t *sst, const cdf_header_t *h, q = (const uint8_t *)(const void *) ((const char *)(const void *)p + ofs - 2 * sizeof(uint32_t)); + if (q < p) { + DPRINTF(("Wrapped around %p < %p\n", q, p)); + goto out; + } if (q > e) { DPRINTF(("Ran of the end %p > %p\n", q, e)); goto out;