summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authortobias <tobias@openbsd.org>2014-11-18 17:03:35 +0000
committertobias <tobias@openbsd.org>2014-11-18 17:03:35 +0000
commit80ab18b026ddb48a176f35c0f9c2bded2290533d (patch)
tree4cddbef31767075cc4575d7577ab79c64823aa78
parentmake pmap_zero_page MP-safe, by using the directmap (diff)
downloadwireguard-openbsd-80ab18b026ddb48a176f35c0f9c2bded2290533d.tar.xz
wireguard-openbsd-80ab18b026ddb48a176f35c0f9c2bded2290533d.zip
Avoid iterating over end of string.
ok millert, otto
-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;