summaryrefslogtreecommitdiff
path: root/usr.bin/patch/pch.c
diff options
context:
space:
mode:
authorTobias Stoeckmann <tobias@cvs.openbsd.org>2014-11-18 17:03:36 +0000
committerTobias Stoeckmann <tobias@cvs.openbsd.org>2014-11-18 17:03:36 +0000
commita3c95420139c1246287929633f81a716e8962d3f (patch)
tree35904cd3c689344102a776415a229cb2797da1a3 /usr.bin/patch/pch.c
parent1aa84a6b4fa793d2d71c503ad197d6ad33ff6fb1 (diff)
Avoid iterating over end of string.
ok millert, otto
Diffstat (limited to 'usr.bin/patch/pch.c')
-rw-r--r--usr.bin/patch/pch.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/usr.bin/patch/pch.c b/usr.bin/patch/pch.c
index ca079101ddb..163446ef2e6 100644
--- a/usr.bin/patch/pch.c
+++ b/usr.bin/patch/pch.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: pch.c,v 1.42 2014/11/17 10:58:09 tobias Exp $ */
+/* $OpenBSD: pch.c,v 1.43 2014/11/18 17:03:35 tobias Exp $ */
/*
* patch - a program to apply diffs to original files
@@ -344,9 +344,9 @@ intuit_diff_type(void)
ok_to_create_file = true;
/*
* If this is a new context diff the character just
- * before the newline is a '*'.
+ * at the end of the line is a '*'.
*/
- while (*s != '\n')
+ while (*s && *s != '\n')
s++;
p_indent = indent;
p_start = previous_line;