summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authornicm <nicm>2019-04-24 20:27:52 +0000
committerNicholas Marriott <nicholas.marriott@gmail.com>2019-04-24 22:34:56 +0100
commit7d06216289cb36fd7b8a16373d8c527f71816e4e (patch)
treec2386d712c865fdd4e0ffe1be8eea74c063ea819
parentd24a44230acf6447ae39347f3c5a27727c1ca4ab (diff)
Do not loop forever if there is a nonprintable character in the format.
-rw-r--r--format-draw.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/format-draw.c b/format-draw.c
index b0b050f6..51404254 100644
--- a/format-draw.c
+++ b/format-draw.c
@@ -837,7 +837,8 @@ format_trim_left(const char *expanded, u_int limit)
*out++ = *cp;
width++;
cp++;
- }
+ } else
+ cp++;
}
*out = '\0';
return (copy);
@@ -883,7 +884,8 @@ format_trim_right(const char *expanded, u_int limit)
*out++ = *cp;
width++;
cp++;
- }
+ } else
+ cp++;
}
*out = '\0';
return (copy);