summaryrefslogtreecommitdiff
path: root/Build/source/libs/zziplib/TLpatches/patch-04-strnlen
diff options
context:
space:
mode:
Diffstat (limited to 'Build/source/libs/zziplib/TLpatches/patch-04-strnlen')
-rw-r--r--Build/source/libs/zziplib/TLpatches/patch-04-strnlen20
1 files changed, 20 insertions, 0 deletions
diff --git a/Build/source/libs/zziplib/TLpatches/patch-04-strnlen b/Build/source/libs/zziplib/TLpatches/patch-04-strnlen
new file mode 100644
index 00000000000..a5f8c38eb2f
--- /dev/null
+++ b/Build/source/libs/zziplib/TLpatches/patch-04-strnlen
@@ -0,0 +1,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)