diff options
author | truckman <truckman@FreeBSD.org> | 2016-06-08 01:17:22 +0000 |
---|---|---|
committer | truckman <truckman@FreeBSD.org> | 2016-06-08 01:17:22 +0000 |
commit | 13f6239c05966efaf7e95318970d3884ee3e13ac (patch) | |
tree | 19b93e8a2e2d9fc3d3e1cc36f89352a635a71693 /bin | |
parent | 809b04224e2d1b2469aef73ecdd5b4eca3f4004e (diff) | |
download | FreeBSD-src-13f6239c05966efaf7e95318970d3884ee3e13ac.zip FreeBSD-src-13f6239c05966efaf7e95318970d3884ee3e13ac.tar.gz |
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
Diffstat (limited to 'bin')
-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 70a4979..9ab41251 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; } |