From 862d9405b857dba35f8f2eb6d0623b9a552d4353 Mon Sep 17 00:00:00 2001 From: delphij Date: Mon, 18 May 2009 22:27:42 +0000 Subject: Virgin import of Christos Zoulas's FILE 5.03. Security: CVE-2009-1515 --- funcs.c | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) (limited to 'funcs.c') diff --git a/funcs.c b/funcs.c index af10688..c6f0d09 100644 --- a/funcs.c +++ b/funcs.c @@ -27,7 +27,7 @@ #include "file.h" #ifndef lint -FILE_RCSID("@(#)$File: funcs.c,v 1.51 2008/11/07 18:57:28 christos Exp $") +FILE_RCSID("@(#)$File: funcs.c,v 1.53 2009/04/07 11:07:00 christos Exp $") #endif /* lint */ #include "magic.h" @@ -303,7 +303,14 @@ file_reset(struct magic_set *ms) file_error(ms, 0, "no magic files loaded"); return -1; } - ms->o.buf = NULL; + if (ms->o.buf) { + free(ms->o.buf); + ms->o.buf = NULL; + } + if (ms->o.pbuf) { + free(ms->o.pbuf); + ms->o.pbuf = NULL; + } ms->event_flags &= ~EVENT_HAD_ERR; ms->error = -1; return 0; -- cgit v1.1