aboutsummaryrefslogtreecommitdiff
path: root/toys/posix
diff options
context:
space:
mode:
authorAndy Chu <andychup@gmail.com>2016-03-06 09:49:50 -0800
committerRob Landley <rob@landley.net>2016-03-10 13:59:32 -0600
commit96a5ed118ce8ad1aaf7889b9eff599bb4517aa49 (patch)
treebc3c58c9f62aed2fdaf9aaaa6747016cfd415b62 /toys/posix
parent1fd80657b06e016217efb7068b08fa9e4aa5650d (diff)
downloadtoybox-96a5ed118ce8ad1aaf7889b9eff599bb4517aa49.tar.gz
Fix segfault in sed -e 'c\'.
Found by afl-fuzz.
Diffstat (limited to 'toys/posix')
-rw-r--r--toys/posix/sed.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/toys/posix/sed.c b/toys/posix/sed.c
index 9b5e6664..3def9d40 100644
--- a/toys/posix/sed.c
+++ b/toys/posix/sed.c
@@ -764,7 +764,7 @@ static void jewel_of_judgement(char **pline, long len)
// Append additional line to pattern argument string?
// We temporarily repurpose "hit" to indicate line continuations
if (corwin && corwin->prev->hit) {
- if (!*pline) error_exit("unfinished %c", corwin->prev->c);;
+ if (!pline || !*pline) error_exit("unfinished %c", corwin->prev->c);;
// Remove half-finished entry from list so remalloc() doesn't confuse it
TT.pattern = TT.pattern->prev;
corwin = dlist_pop(&TT.pattern);