# HG changeset patch # User Paper # Date 1711155100 14400 # Node ID d6f8f73a0c5016b12fd2c285f32ac16e09de3bfe # Parent 21aad49ed2c981620312fa7d3a9ccc63cb5adb3e util: make strnchr an actual strnchr diff -r 21aad49ed2c9 -r d6f8f73a0c50 src/util.c --- 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; }