]> granicus.if.org Git - file/commitdiff
Add missing check offset test (Francisco Alonso, Jan Kaluza at RedHat)
authorChristos Zoulas <christos@zoulas.com>
Mon, 9 Jun 2014 13:04:37 +0000 (13:04 +0000)
committerChristos Zoulas <christos@zoulas.com>
Mon, 9 Jun 2014 13:04:37 +0000 (13:04 +0000)
src/cdf.c

index d018e79958c0fb1517495061e901e3ff51e38a9a..106fc7ac02f39143aa643ec0f13410181c92a1cf 100644 (file)
--- a/src/cdf.c
+++ b/src/cdf.c
@@ -35,7 +35,7 @@
 #include "file.h"
 
 #ifndef lint
-FILE_RCSID("@(#)$File: cdf.c,v 1.62 2014/06/04 17:26:07 christos Exp $")
+FILE_RCSID("@(#)$File: cdf.c,v 1.63 2014/06/09 13:04:37 christos Exp $")
 #endif
 
 #include <assert.h>
@@ -816,7 +816,11 @@ cdf_read_property_info(const cdf_stream_t *sst, const cdf_header_t *h,
        if (cdf_check_stream_offset(sst, h, e, 0, __LINE__) == -1)
                goto out;
        for (i = 0; i < sh.sh_properties; i++) {
-               size_t ofs = CDF_GETUINT32(p, (i << 1) + 1);
+               size_t tail = (i << 1) + 1;
+               if (cdf_check_stream_offset(sst, h, p, tail * sizeof(uint32_t),
+                   __LINE__) == -1)
+                       goto out;
+               size_t ofs = CDF_GETUINT32(p, tail);
                q = (const uint8_t *)(const void *)
                    ((const char *)(const void *)p + ofs
                    - 2 * sizeof(uint32_t));