]> git.ipfire.org Git - thirdparty/openssl.git/commitdiff
Check length first in BUF_strnlen().
authorBen Laurie <ben@links.org>
Thu, 22 May 2014 09:11:40 +0000 (10:11 +0100)
committerBen Laurie <ben@links.org>
Thu, 22 May 2014 09:13:22 +0000 (10:13 +0100)
crypto/buffer/buf_str.c

index 35e4a2e7892617f879b712ade26b2f0cd058d73d..b4ff71ed5a9bb55fc85a40d15cb0398e64c736d4 100644 (file)
@@ -66,7 +66,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;