aboutsummaryrefslogtreecommitdiff
path: root/libbb/dump.c
diff options
context:
space:
mode:
authorDenis Vlasenko <vda.linux@googlemail.com>2008-08-23 23:15:48 +0000
committerDenis Vlasenko <vda.linux@googlemail.com>2008-08-23 23:15:48 +0000
commit15f2fdb2b9ba0d397babe0922ae28f84e91505f9 (patch)
tree7d4c22cda9908393ead53c79b11f779dc96977f2 /libbb/dump.c
parent7fe21c69cdfbe3863aa69f40df6bbbe7abe4af8d (diff)
downloadbusybox-15f2fdb2b9ba0d397babe0922ae28f84e91505f9.tar.gz
hexdump: fix SEGV in hexdump -e ""
Diffstat (limited to 'libbb/dump.c')
-rw-r--r--libbb/dump.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/libbb/dump.c b/libbb/dump.c
index 74c5e1691..e7722de5a 100644
--- a/libbb/dump.c
+++ b/libbb/dump.c
@@ -298,7 +298,7 @@ static void rewrite(priv_dumper_t *dumper, FS *fs)
* 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 < dumper->blocksize
&& !(fu->flags & F_SETREP) && fu->bcnt
) {
@@ -723,7 +723,8 @@ void FAST_FUNC bb_dump_add(dumper_t* pub_dumper, const char *fmt)
nextfupp = &tfs->nextfu;
/* take the format string and break it up into format units */
- for (p = fmt;;) {
+ p = fmt;
+ for (;;) {
p = skip_whitespace(p);
if (!*p) {
break;