svn commit: r298530 - head/usr.bin/patch

Pedro F. Giffuni pfg at FreeBSD.org
Sun Apr 24 04:08:38 UTC 2016


Author: pfg
Date: Sun Apr 24 04:08:36 2016
New Revision: 298530
URL: https://svnweb.freebsd.org/changeset/base/298530

Log:
  patch(1): avoid signed integer overflow when debugging.
  
  Integer i is used to index p_end of type LINENUM (actually long).
  
  Match the types.
  
  MFC after:	5 days

Modified:
  head/usr.bin/patch/pch.c

Modified: head/usr.bin/patch/pch.c
==============================================================================
--- head/usr.bin/patch/pch.c	Sun Apr 24 03:15:10 2016	(r298529)
+++ head/usr.bin/patch/pch.c	Sun Apr 24 04:08:36 2016	(r298530)
@@ -1142,7 +1142,7 @@ hunk_done:
 			say("Not enough memory to swap next hunk!\n");
 #ifdef DEBUGGING
 	if (debug & 2) {
-		int	i;
+		LINENUM	i;
 		char	special;
 
 		for (i = 0; i <= p_end; i++) {
@@ -1150,7 +1150,7 @@ hunk_done:
 				special = '^';
 			else
 				special = ' ';
-			fprintf(stderr, "%3d %c %c %s", i, p_char[i],
+			fprintf(stderr, "%3ld %c %c %s", i, p_char[i],
 			    special, p_line[i]);
 			fflush(stderr);
 		}


More information about the svn-src-head mailing list