From: Christos Zoulas Date: Thu, 10 Sep 2015 14:39:55 +0000 (+0000) Subject: PR/475: Fix past end of buffer read. X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=9edf13cae19e9de85a240e6e811406df6b414259;p=file PR/475: Fix past end of buffer read. --- diff --git a/src/apprentice.c b/src/apprentice.c index 52cd83c5..3eb1be03 100644 --- a/src/apprentice.c +++ b/src/apprentice.c @@ -32,7 +32,7 @@ #include "file.h" #ifndef lint -FILE_RCSID("@(#)$File: apprentice.c,v 1.235 2015/09/10 13:59:47 christos Exp $") +FILE_RCSID("@(#)$File: apprentice.c,v 1.236 2015/09/10 14:39:55 christos Exp $") #endif /* lint */ #include "magic.h" @@ -2742,6 +2742,7 @@ getstr(struct magic_set *ms, struct magic *m, const char *s, int warn) } else *p++ = (char)c; } + --s; out: *p = '\0'; m->vallen = CAST(unsigned char, (p - origp));