Buffer bugs fixed, should work better. Hopefully it won't crash anymore.
git-svn-id: https://svn.code.sf.net/p/nsis/code/NSIS/trunk@945 212acab6-be3b-0410-9dea-997c60f758d6
This commit is contained in:
parent
a1275ada05
commit
5c627b632c
5 changed files with 64 additions and 55 deletions
|
@ -35,19 +35,4 @@ char *my_strrchr(const char *string, int c) {
|
|||
void *my_memset(void *dest, int c, size_t count) {
|
||||
for (size_t i = 0; i < count; i++) ((char*)dest)[i]=c;
|
||||
return dest;
|
||||
}
|
||||
|
||||
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++) {
|
||||
s1=&((char*)string)[i];
|
||||
s2=(char*)strCharSet;
|
||||
while (*s1++ == *s2++)
|
||||
if (!*s2)
|
||||
return &((char*)string)[i];
|
||||
}
|
||||
return 0;
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue