]> granicus.if.org Git - file/commitdiff
leave one byte to look at.
authorChristos Zoulas <christos@zoulas.com>
Thu, 26 Jul 2001 13:15:49 +0000 (13:15 +0000)
committerChristos Zoulas <christos@zoulas.com>
Thu, 26 Jul 2001 13:15:49 +0000 (13:15 +0000)
src/ascmagic.c

index df048aaae6dfc7ad9928efa24e390a58920757c1..c2a2f95fa1ed799d5647c07cd50819bd7a263276 100644 (file)
@@ -46,7 +46,7 @@
 #include "names.h"
 
 #ifndef        lint
-FILE_RCSID("@(#)$Id: ascmagic.c,v 1.29 2000/08/05 19:00:11 christos Exp $")
+FILE_RCSID("@(#)$Id: ascmagic.c,v 1.30 2001/07/26 13:15:49 christos Exp $")
 #endif /* lint */
 
 typedef unsigned long unichar;
@@ -105,9 +105,12 @@ ascmagic(buf, nbytes)
                return 1;
        }
 
-       /* Undo the NUL-termination kindly provided by process() */
+       /*
+        * Undo the NUL-termination kindly provided by process()
+        * but leave at least one byte to look at
+        */
 
-       while (nbytes > 0 && buf[nbytes - 1] == '\0')
+       while (nbytes > 1 && buf[nbytes - 1] == '\0')
                nbytes--;
 
        /*