From 1a924c729cc82916157766dbb0389b73fd4a79d8 Mon Sep 17 00:00:00 2001 From: truckman Date: Wed, 1 Jun 2016 16:56:29 +0000 Subject: The (i < PROMPTLEN - 1) test added by r300442 in the code for the default case of \c in the prompt format string is a no-op. We already passed this test at the top of the loop, and i has not yet been incremented in this path. Change this test to (i < PROMPTLEN - 2). Reported by: Coverity CID: 1008328 Reviewed by: cem MFC after: 1 week --- bin/sh/parser.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'bin') diff --git a/bin/sh/parser.c b/bin/sh/parser.c index cc04a2a..1297748 100644 --- a/bin/sh/parser.c +++ b/bin/sh/parser.c @@ -2063,7 +2063,7 @@ getprompt(void *unused __unused) */ default: ps[i] = '\\'; - if (i < PROMPTLEN - 1) + if (i < PROMPTLEN - 2) ps[++i] = *fmt; break; } -- cgit v1.1