From: Ben Laurie Date: Thu, 22 May 2014 09:11:40 +0000 (+0100) Subject: Check length first in BUF_strnlen(). X-Git-Tag: OpenSSL_1_0_2-beta2~194 X-Git-Url: https://git.librecmc.org/?a=commitdiff_plain;h=d77501d8fd1a49ff82e2824ded6f341f4fc8307a;p=oweals%2Fopenssl.git Check length first in BUF_strnlen(). --- diff --git a/crypto/buffer/buf_str.c b/crypto/buffer/buf_str.c index 60dab54344..12ef1fa064 100644 --- a/crypto/buffer/buf_str.c +++ b/crypto/buffer/buf_str.c @@ -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;