svn commit: r301571 - stable/10/bin/sh

Don Lewis truckman at FreeBSD.org
Wed Jun 8 01:17:23 UTC 2016


Author: truckman
Date: Wed Jun  8 01:17:22 2016
New Revision: 301571
URL: https://svnweb.freebsd.org/changeset/base/301571

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

Modified:
  stable/10/bin/sh/parser.c
Directory Properties:
  stable/10/   (props changed)

Modified: stable/10/bin/sh/parser.c
==============================================================================
--- stable/10/bin/sh/parser.c	Wed Jun  8 00:29:48 2016	(r301570)
+++ stable/10/bin/sh/parser.c	Wed Jun  8 01:17:22 2016	(r301571)
@@ -2039,7 +2039,7 @@ getprompt(void *unused __unused)
 				 */
 			default:
 				ps[i] = '\\';
-				if (i < PROMPTLEN - 1)
+				if (i < PROMPTLEN - 2)
 					ps[++i] = *fmt;
 				break;
 			}


More information about the svn-src-stable mailing list