Browse Source

public: fix Q_memmem counting haystack size incorrectly

pull/2/head
Alibek Omarov 2 years ago
parent
commit
75ccd2283b
  1. 5
      public/crtlib.c

5
public/crtlib.c

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

Loading…
Cancel
Save