diff options
author | truckman <truckman@FreeBSD.org> | 2016-06-01 16:56:29 +0000 |
---|---|---|
committer | truckman <truckman@FreeBSD.org> | 2016-06-01 16:56:29 +0000 |
commit | 1a924c729cc82916157766dbb0389b73fd4a79d8 (patch) | |
tree | 9dab08aa960ea81e17907e7854998309275f2b4c | |
parent | 80c4320260a7e9b4a0152b24deefd4ddf4c66118 (diff) | |
download | FreeBSD-src-1a924c729cc82916157766dbb0389b73fd4a79d8.zip FreeBSD-src-1a924c729cc82916157766dbb0389b73fd4a79d8.tar.gz |
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
-rw-r--r-- | bin/sh/parser.c | 2 |
1 files changed, 1 insertions, 1 deletions
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; } |