Author: truckman
Date: Wed Jun  1 16:56:29 2016
New Revision: 301139
URL: https://svnweb.freebsd.org/changeset/base/301139

Log:
  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

Modified:
  head/bin/sh/parser.c

Modified: head/bin/sh/parser.c
==============================================================================
--- head/bin/sh/parser.c        Wed Jun  1 16:53:02 2016        (r301138)
+++ head/bin/sh/parser.c        Wed Jun  1 16:56:29 2016        (r301139)
@@ -2063,7 +2063,7 @@ getprompt(void *unused __unused)
                                 */
                        default:
                                ps[i] = '\\';
-                               if (i < PROMPTLEN - 1)
+                               if (i < PROMPTLEN - 2)
                                        ps[++i] = *fmt;
                                break;
                        }
_______________________________________________
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"

Reply via email to