public: fix Q_memmem counting haystack size incorrectly

This commit is contained in:
Alibek Omarov 2023-01-04 17:16:27 +03:00
parent 409edf5a70
commit 75ccd2283b

View file

@ -382,8 +382,11 @@ const byte *Q_memmem( const byte *haystack, size_t haystacklen, const byte *need
if( !memcmp( i, needle, needlelen )) if( !memcmp( i, needle, needlelen ))
return i; return i;
// skip one byte
i++;
haystacklen -= i - haystack; haystacklen -= i - haystack;
haystack = i + 1; haystack = i;
} }
return NULL; return NULL;