From c0a40def2f4f08ee17c46f8fca2c8b05d67c68a1 Mon Sep 17 00:00:00 2001 From: Christos Zoulas Date: Thu, 9 Mar 2017 16:57:53 +0000 Subject: use the correct buffer size; found by oss-fuzz --- src/readcdf.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/readcdf.c b/src/readcdf.c index 20e631d6..513bbb94 100644 --- a/src/readcdf.c +++ b/src/readcdf.c @@ -26,7 +26,7 @@ #include "file.h" #ifndef lint -FILE_RCSID("@(#)$File: readcdf.c,v 1.63 2016/10/18 22:25:42 christos Exp $") +FILE_RCSID("@(#)$File: readcdf.c,v 1.64 2017/03/09 16:57:53 christos Exp $") #endif #include @@ -603,7 +603,7 @@ file_trycdf(struct magic_set *ms, int fd, const unsigned char *buf, if ((i = cdf_read_user_stream(&info, &h, &sat, &ssat, &sst, &dir, "FileHeader", &scn)) != -1) { #define HWP5_SIGNATURE "HWP Document File" - if (scn.sst_dirlen >= sizeof(HWP5_SIGNATURE) - 1 + if (scn.sst_len * scn.sst_ss >= sizeof(HWP5_SIGNATURE) - 1 && memcmp(scn.sst_tab, HWP5_SIGNATURE, sizeof(HWP5_SIGNATURE) - 1) == 0) { if (NOTMIME(ms)) { -- cgit v1.2.1