Check length first in BUF_strnlen().
This commit is contained in:
parent
15e4565984
commit
d77501d8fd
@ -64,7 +64,7 @@ size_t BUF_strnlen(const char *str, size_t maxlen)
|
||||
{
|
||||
const char *p;
|
||||
|
||||
for (p = str; *p != '\0' && maxlen-- != 0; ++p)
|
||||
for (p = str; maxlen-- != 0 && *p != '\0'; ++p)
|
||||
;
|
||||
|
||||
return p - str;
|
||||
|
Loading…
x
Reference in New Issue
Block a user