From: Christos Zoulas Date: Wed, 6 May 2009 14:27:30 +0000 (+0000) Subject: avoid wrap-around. X-Git-Tag: FILE5_04~79 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=26ba4d122deedd0a3ae4cf9e97e9a38a6e170d19;p=file avoid wrap-around. --- diff --git a/src/cdf.c b/src/cdf.c index 467f5577..32b99f3c 100644 --- a/src/cdf.c +++ b/src/cdf.c @@ -32,7 +32,7 @@ #include "file.h" #ifndef lint -FILE_RCSID("@(#)$File: cdf.c,v 1.27 2009/05/05 22:48:51 christos Exp $") +FILE_RCSID("@(#)$File: cdf.c,v 1.28 2009/05/06 14:23:06 christos Exp $") #endif #include @@ -232,7 +232,7 @@ cdf_check_stream_offset(const cdf_stream_t *sst, const void *p, size_t tail) { const char *b = (const char *)sst->sst_tab; const char *e = ((const char *)p) + tail; - if ((size_t)(e - b) < sst->sst_dirlen * sst->sst_len) + if (e >= b && (size_t)(e - b) < sst->sst_dirlen * sst->sst_len) return 0; DPRINTF((stderr, "offset begin %p end %p %zu >= %zu\n", b, e, (size_t)(e - b), sst->sst_dirlen * sst->sst_len));