]> granicus.if.org Git - file/commitdiff
Use the proper sector size when checking stream offsets (Francisco Alonso and
authorChristos Zoulas <christos@zoulas.com>
Wed, 4 Jun 2014 17:26:07 +0000 (17:26 +0000)
committerChristos Zoulas <christos@zoulas.com>
Wed, 4 Jun 2014 17:26:07 +0000 (17:26 +0000)
Jan Kaluza at RedHat)

src/cdf.c

index 6652581c27b843379a3e47b5223be9e7c9485445..0bfb31a229af5fc05579593e3ea83568b88cf3bb 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.60 2014/05/21 13:04:38 christos Exp $")
+FILE_RCSID("@(#)$File: cdf.c,v 1.61 2014/06/04 17:23:19 christos Exp $")
 #endif
 
 #include <assert.h>
@@ -267,13 +267,15 @@ cdf_check_stream_offset(const cdf_stream_t *sst, const cdf_header_t *h,
 {
        const char *b = (const char *)sst->sst_tab;
        const char *e = ((const char *)p) + tail;
+       size_t ss = sst->sst_dirlen < h->h_min_size_standard_stream ?
+           CDF_SHORT_SEC_SIZE(h) : CDF_SEC_SIZE(h);
        (void)&line;
-       if (e >= b && (size_t)(e - b) <= CDF_SEC_SIZE(h) * sst->sst_len)
+       if (e >= b && (size_t)(e - b) <= ss * sst->sst_len)
                return 0;
        DPRINTF(("%d: offset begin %p < end %p || %" SIZE_T_FORMAT "u"
            " > %" SIZE_T_FORMAT "u [%" SIZE_T_FORMAT "u %"
            SIZE_T_FORMAT "u]\n", line, b, e, (size_t)(e - b),
-           CDF_SEC_SIZE(h) * sst->sst_len, CDF_SEC_SIZE(h), sst->sst_len));
+           ss * sst->sst_len, ss, sst->sst_len));
        errno = EFTYPE;
        return -1;
 }