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
This commit is contained in:
parent
7e77774311
commit
eaf2e1e6f7
@ -2063,7 +2063,7 @@ getprompt(void *unused __unused)
|
||||
*/
|
||||
default:
|
||||
ps[i] = '\\';
|
||||
if (i < PROMPTLEN - 1)
|
||||
if (i < PROMPTLEN - 2)
|
||||
ps[++i] = *fmt;
|
||||
break;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user