]> granicus.if.org Git - file/commitdiff
Don't double increment pointer in the OCTALIFY case, leading to buffer overrun.
authorChristos Zoulas <christos@zoulas.com>
Wed, 11 May 2011 01:02:41 +0000 (01:02 +0000)
committerChristos Zoulas <christos@zoulas.com>
Wed, 11 May 2011 01:02:41 +0000 (01:02 +0000)
src/funcs.c

index 318e5bfb7060f0b0a09d1597bc88ae5fd4bd52be..71257b05ccba386a2e190a84b1e9fa63f72c229c 100644 (file)
@@ -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);
                }