diff options
author | Theo de Raadt <deraadt@cvs.openbsd.org> | 1998-06-11 06:20:19 +0000 |
---|---|---|
committer | Theo de Raadt <deraadt@cvs.openbsd.org> | 1998-06-11 06:20:19 +0000 |
commit | 8959c415e80d91fd48938803bc8373ee1cded042 (patch) | |
tree | abbc5472e57c2cf62b3245a7db62807e439efa3d /usr.bin | |
parent | 0564cd711ecd8a2a235301d7c3cb70392990926a (diff) |
Don't segfault just because a line starts with NUL; ross
Diffstat (limited to 'usr.bin')
-rw-r--r-- | usr.bin/mail/fio.c | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/usr.bin/mail/fio.c b/usr.bin/mail/fio.c index 1f1b21cd2d9..139c4eef2e0 100644 --- a/usr.bin/mail/fio.c +++ b/usr.bin/mail/fio.c @@ -1,4 +1,4 @@ -/* $OpenBSD: fio.c,v 1.14 1997/11/14 00:23:47 millert Exp $ */ +/* $OpenBSD: fio.c,v 1.15 1998/06/11 06:20:18 deraadt Exp $ */ /* $NetBSD: fio.c,v 1.8 1997/07/07 22:57:55 phil Exp $ */ /* @@ -38,7 +38,7 @@ #if 0 static char sccsid[] = "@(#)fio.c 8.2 (Berkeley) 4/20/95"; #else -static char rcsid[] = "$OpenBSD: fio.c,v 1.14 1997/11/14 00:23:47 millert Exp $"; +static char rcsid[] = "$OpenBSD: fio.c,v 1.15 1998/06/11 06:20:18 deraadt Exp $"; #endif #endif /* not lint */ @@ -120,7 +120,8 @@ setptr(ibuf, offset) (void)fwrite(linebuf, sizeof(*linebuf), count, otf); if (ferror(otf)) err(1, "/tmp"); - linebuf[count - 1] = '\0'; + if (count) + linebuf[count - 1] = '\0'; if (maybe && linebuf[0] == 'F' && ishead(linebuf)) { msgCount++; if (append(&this, mestmp)) |