summaryrefslogtreecommitdiff
path: root/Build/source/libs/zziplib/TLpatches/patch-04-strnlen
blob: a5f8c38eb2ff7bab31d6ba521fa54d4a66592e91 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
diff -ur zziplib-0.13.68.orig/zzip/__string.h zziplib-0.13.68/zzip/__string.h
--- zziplib-0.13.68.orig/zzip/__string.h	Tue Feb 06 05:00:56 2018
+++ zziplib-0.13.68/zzip/__string.h	Thu Mar 01 12:13:00 2018
@@ -18,6 +18,16 @@
 #define _zzip_strndup strndup
 #else
 
+static size_t  my_strnlen(const char*  str, size_t  maxlen)
+{
+    char *p = memchr(str, 0, maxlen);
+    if (p == NULL)
+       return maxlen;
+    else
+       return (p - str);
+}
+#define strnlen(x,y) my_strnlen((x),(y))
+
 /* if your system does not have strndup: */
 zzip__new__ static char *
 _zzip_strndup(char const *p, size_t maxlen)