From 5275f4c2ca43d24a0d413ab19e4fe76cc918f3a7 Mon Sep 17 00:00:00 2001 From: kichik Date: Thu, 5 Sep 2002 16:14:30 +0000 Subject: [PATCH] Fixed a bug with my_strstr git-svn-id: https://svn.code.sf.net/p/nsis/code/NSIS/trunk@926 212acab6-be3b-0410-9dea-997c60f758d6 --- Contrib/Makensisw/noclib.cpp | 1 + Contrib/nsExec/nsexec.c | 1 + 2 files changed, 2 insertions(+) diff --git a/Contrib/Makensisw/noclib.cpp b/Contrib/Makensisw/noclib.cpp index b650f84a..bced115a 100644 --- a/Contrib/Makensisw/noclib.cpp +++ b/Contrib/Makensisw/noclib.cpp @@ -39,6 +39,7 @@ void *my_memset(void *dest, int c, size_t count) { char *my_strstr(const char *string, const char *strCharSet) { if (!*strCharSet) return (char*)string; + if (lstrlen(string) < lstrlen(strCharSet)) return 0; size_t chklen=lstrlen(string)-lstrlen(strCharSet); char *s1, *s2; for (size_t i = 0; i < chklen; i++) { diff --git a/Contrib/nsExec/nsexec.c b/Contrib/nsExec/nsexec.c index 79ba567a..a1b8c999 100644 --- a/Contrib/nsExec/nsexec.c +++ b/Contrib/nsExec/nsexec.c @@ -164,6 +164,7 @@ char *my_strstr(const char *string, const char *strCharSet) { char *s1, *s2; size_t chklen; size_t i; + if (lstrlen(string) < lstrlen(strCharSet)) return 0; if (!*strCharSet) return (char*)string; chklen=lstrlen(string)-lstrlen(strCharSet); for (i = 0; i < chklen; i++) {