summaryrefslogtreecommitdiff
path: root/usr.bin
diff options
context:
space:
mode:
authorTobias Ulmer <tobiasu@cvs.openbsd.org>2015-03-27 10:09:31 +0000
committerTobias Ulmer <tobiasu@cvs.openbsd.org>2015-03-27 10:09:31 +0000
commit143447815e595b508548bc5157155da92d585bb6 (patch)
tree46ef1e0842de5a987e4aeca1858ec96d301f2e09 /usr.bin
parent0855743f252cc9abcac0e7cfade4cf2f34847eb5 (diff)
Don't display empty error context.
Context extraction didn't handle this case and showed uninitialized memory. ok tobias, miod
Diffstat (limited to 'usr.bin')
-rw-r--r--usr.bin/awk/lib.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/usr.bin/awk/lib.c b/usr.bin/awk/lib.c
index a62df2dc86d..753fa8bffea 100644
--- a/usr.bin/awk/lib.c
+++ b/usr.bin/awk/lib.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: lib.c,v 1.20 2011/09/28 19:27:18 millert Exp $ */
+/* $OpenBSD: lib.c,v 1.21 2015/03/27 10:09:30 tobiasu Exp $ */
/****************************************************************
Copyright (C) Lucent Technologies 1997
All Rights Reserved
@@ -648,7 +648,8 @@ void eprint(void) /* try to print context around error */
static int been_here = 0;
extern char ebuf[], *ep;
- if (compile_time == 2 || compile_time == 0 || been_here++ > 0)
+ if (compile_time == 2 || compile_time == 0 || been_here++ > 0 ||
+ ebuf == ep)
return;
p = ep - 1;
if (p > ebuf && *p == '\n')