diff options
| author | David E. O'Brien <obrien@FreeBSD.org> | 2001-10-08 22:50:54 +0000 |
|---|---|---|
| committer | David E. O'Brien <obrien@FreeBSD.org> | 2001-10-08 22:50:54 +0000 |
| commit | 649d615c25f64d6f740ad79df7d6d25d98c9a88b (patch) | |
| tree | 51ee57c1f591278e5d817e2260d7e1132323a26f /contrib/file/ascmagic.c | |
| parent | 2e67ec0205346336544da4aeebec926df199ee19 (diff) | |
Notes
Diffstat (limited to 'contrib/file/ascmagic.c')
| -rw-r--r-- | contrib/file/ascmagic.c | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/contrib/file/ascmagic.c b/contrib/file/ascmagic.c index df048aaae6df..c2a2f95fa1ed 100644 --- a/contrib/file/ascmagic.c +++ b/contrib/file/ascmagic.c @@ -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--; /* |
