From 81085e95f4c900b60a4659258cd7d4e20cf13688 Mon Sep 17 00:00:00 2001 From: pfg Date: Sun, 24 Apr 2016 04:08:36 +0000 Subject: 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 --- usr.bin/patch/pch.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'usr.bin') diff --git a/usr.bin/patch/pch.c b/usr.bin/patch/pch.c index 0db459e..e12e833 100644 --- a/usr.bin/patch/pch.c +++ b/usr.bin/patch/pch.c @@ -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); } -- cgit v1.1