From 183500e00eaaf59ccd08b81bb592f1fbf221dc0d Mon Sep 17 00:00:00 2001 From: truckman Date: Wed, 8 Jun 2016 01:17:22 +0000 Subject: [PATCH] MFC r301139 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 Differential Revision: https://reviews.freebsd.org/D6552 git-svn-id: svn://svn.freebsd.org/base/stable/10@301571 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f --- bin/sh/parser.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bin/sh/parser.c b/bin/sh/parser.c index 70a497935..9ab412517 100644 --- a/bin/sh/parser.c +++ b/bin/sh/parser.c @@ -2039,7 +2039,7 @@ getprompt(void *unused __unused) */ default: ps[i] = '\\'; - if (i < PROMPTLEN - 1) + if (i < PROMPTLEN - 2) ps[++i] = *fmt; break; } -- 2.42.0