summaryrefslogtreecommitdiffstats
path: root/contrib/file/src/cdf.c
diff options
context:
space:
mode:
authorRenato Botelho <renato@netgate.com>2016-07-11 14:09:23 -0300
committerRenato Botelho <renato@netgate.com>2016-07-11 14:09:23 -0300
commit3a4027cfafa37c1a0c0b05987c0edb1452c7bd2b (patch)
tree66dc775beb72a91e58e26949f9cba8fbd74c9301 /contrib/file/src/cdf.c
parentac9e13a9f38640234319dfe1b3c26b7e69057982 (diff)
parent0ddba37c51521e5d2e7ada2ebd4619a703477036 (diff)
downloadFreeBSD-src-3a4027cfafa37c1a0c0b05987c0edb1452c7bd2b.zip
FreeBSD-src-3a4027cfafa37c1a0c0b05987c0edb1452c7bd2b.tar.gz
Merge remote-tracking branch 'origin/stable/10' into devel
Diffstat (limited to 'contrib/file/src/cdf.c')
-rw-r--r--contrib/file/src/cdf.c10
1 files changed, 6 insertions, 4 deletions
diff --git a/contrib/file/src/cdf.c b/contrib/file/src/cdf.c
index cc587fc..4ec65b4 100644
--- a/contrib/file/src/cdf.c
+++ b/contrib/file/src/cdf.c
@@ -35,7 +35,7 @@
#include "file.h"
#ifndef lint
-FILE_RCSID("@(#)$File: cdf.c,v 1.80 2016/05/06 15:17:10 christos Exp $")
+FILE_RCSID("@(#)$File: cdf.c,v 1.82 2016/06/01 22:25:25 christos Exp $")
#endif
#include <assert.h>
@@ -572,11 +572,11 @@ cdf_read_short_sector_chain(const cdf_header_t *h,
{
size_t ss = CDF_SHORT_SEC_SIZE(h), i, j;
scn->sst_tab = NULL;
- scn->sst_len = cdf_count_chain(ssat, sid, ss);
+ scn->sst_len = cdf_count_chain(ssat, sid, CDF_SEC_SIZE(h));
scn->sst_dirlen = len;
scn->sst_ss = ss;
- if (sst->sst_tab == NULL || scn->sst_len == (size_t)-1)
+ if (scn->sst_len == (size_t)-1)
goto out;
scn->sst_tab = calloc(scn->sst_len, ss);
@@ -683,7 +683,7 @@ cdf_read_ssat(const cdf_info_t *info, const cdf_header_t *h,
cdf_secid_t sid = h->h_secid_first_sector_in_short_sat;
ssat->sat_tab = NULL;
- ssat->sat_len = cdf_count_chain(sat, sid, CDF_SEC_SIZE(h));
+ ssat->sat_len = cdf_count_chain(sat, sid, ss);
if (ssat->sat_len == (size_t)-1)
goto out;
@@ -1068,6 +1068,8 @@ cdf_unpack_catalog(const cdf_header_t *h, const cdf_stream_t *sst,
if (b > eb)
break;
}
+ if (nr == 0)
+ return -1;
nr--;
*cat = CAST(cdf_catalog_t *,
malloc(sizeof(cdf_catalog_t) + nr * sizeof(*ce)));
OpenPOWER on IntegriCloud