From 93617e1a095db3c8e6551d90197c9bc64b224150 Mon Sep 17 00:00:00 2001 From: Christos Zoulas Date: Wed, 11 May 2011 01:02:41 +0000 Subject: [PATCH] Don't double increment pointer in the OCTALIFY case, leading to buffer overrun. --- src/funcs.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/funcs.c b/src/funcs.c index 318e5bfb..71257b05 100644 --- a/src/funcs.c +++ b/src/funcs.c @@ -27,7 +27,7 @@ #include "file.h" #ifndef lint -FILE_RCSID("@(#)$File: funcs.c,v 1.55 2010/07/21 16:47:17 christos Exp $") +FILE_RCSID("@(#)$File: funcs.c,v 1.56 2011/02/03 01:43:33 christos Exp $") #endif /* lint */ #include "magic.h" @@ -392,9 +392,9 @@ file_getbuffer(struct magic_set *ms) } #endif - for (np = ms->o.pbuf, op = ms->o.buf; *op; op++) { + for (np = ms->o.pbuf, op = ms->o.buf; *op;) { if (isprint((unsigned char)*op)) { - *np++ = *op; + *np++ = *op++; } else { OCTALIFY(np, op); } -- 2.40.0