tweaks: some extra checks on lengths

This commit is contained in:
Liam Murphy
2020-11-05 04:43:40 +00:00
committed by Markus F.X.J. Oberhumer
parent 4f3054f07d
commit 4702f12818
2 changed files with 6 additions and 0 deletions
+3
View File
@@ -241,6 +241,9 @@ int __acc_cdecl_qsort le64_compare_signed(const void *e1, const void *e2) {
int find(const void *b, int blen, const void *what, int wlen) {
if (b == NULL || blen <= 0 || what == NULL || wlen <= 0)
return -1;
// Fast exit if the wanted string is longer than the buffer.
if (wlen > blen)
return -1;
int i;
const unsigned char *base = (const unsigned char *) b;