changeset 10:d6f8f73a0c50 v2.1

util: make strnchr an actual strnchr
author Paper <paper@paper.us.eu.org>
date Fri, 22 Mar 2024 20:51:40 -0400
parents 21aad49ed2c9
children a0bd92c4c0e8
files src/util.c
diffstat 1 files changed, 1 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/src/util.c	Fri Mar 22 20:50:47 2024 -0400
+++ b/src/util.c	Fri Mar 22 20:51:40 2024 -0400
@@ -17,7 +17,7 @@
 }
 
 char* EDL_internal_strnchr(const char* haystack, char needle, size_t length) {
-	for (; length && *haystack != needle; haystack++, length--);
+	for (; length && *haystack && *haystack != needle; haystack++, length--);
 
 	return length ? haystack : NULL;
 }