Apply the following from FreeBSD / OpenBSD:

323965 | imp | 2017-09-23 23:04:06 -0600 (Sat, 23 Sep 2017) | 8 lines

Don't display empty error context.

Context extraction didn't handle this case and showed uninitialized memory.

Obtained from: OpenBSD lib.c 1.21
Sponsored by: Netflix
Differential Revision: https://reviews.freebsd.org/D12379
This commit is contained in:
M. Warner Losh 2019-06-02 15:23:06 -06:00 committed by Arnold D. Robbins
parent 0939e3392b
commit 9310d452c9

2
lib.c
View File

@ -647,7 +647,7 @@ 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;
if (ebuf == ep)
return;