From ec252a0e8ba9490910124fdad31b4191e33306cd Mon Sep 17 00:00:00 2001 From: tjr Date: Mon, 27 May 2002 03:17:28 +0000 Subject: From NetBSD: Revision 1.10 Sat Oct 14 17:41:55 2000 UTC by bjh21 Don't core dump with an empty format string. Fixes PR#11218. Patch supplied by Launey Thomas. Obtained from: NetBSD --- usr.bin/hexdump/parse.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) (limited to 'usr.bin/hexdump/parse.c') diff --git a/usr.bin/hexdump/parse.c b/usr.bin/hexdump/parse.c index 85e035e..d928a3f 100644 --- a/usr.bin/hexdump/parse.c +++ b/usr.bin/hexdump/parse.c @@ -424,7 +424,7 @@ isint2: switch(fu->bcnt) { * If, rep count is greater than 1, no trailing whitespace * gets output from the last iteration of the format unit. */ - for (fu = fs->nextfu;; fu = fu->nextfu) { + for (fu = fs->nextfu; fu; fu = fu->nextfu) { if (!fu->nextfu && fs->bcnt < blocksize && !(fu->flags&F_SETREP) && fu->bcnt) fu->reps += (blocksize - fs->bcnt) / fu->bcnt; @@ -437,8 +437,6 @@ isint2: switch(fu->bcnt) { if (p2) pr->nospace = p2; } - if (!fu->nextfu) - break; } #ifdef DEBUG for (fu = fs->nextfu; fu; fu = fu->nextfu) { -- cgit v1.1