diff options
author | mrezai <mhd.rezai@gmail.com> | 2016-04-15 19:03:35 +0430 |
---|---|---|
committer | mrezai <mhd.rezai@gmail.com> | 2016-04-15 19:03:35 +0430 |
commit | e97922f22038e9049ed4c2db5b3736dfaa0edde3 (patch) | |
tree | 37e036a343e7482a387b7acd0a88509af78a69eb /drivers/builtin_openssl2/crypto/buffer/buf_str.c | |
parent | 880f4abda44a42532abb6f15999a90bc85f6264a (diff) |
Update OpenSSL to version 1.0.2g
Diffstat (limited to 'drivers/builtin_openssl2/crypto/buffer/buf_str.c')
-rw-r--r-- | drivers/builtin_openssl2/crypto/buffer/buf_str.c | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/drivers/builtin_openssl2/crypto/buffer/buf_str.c b/drivers/builtin_openssl2/crypto/buffer/buf_str.c index 233af246e4..fa0d608e76 100644 --- a/drivers/builtin_openssl2/crypto/buffer/buf_str.c +++ b/drivers/builtin_openssl2/crypto/buffer/buf_str.c @@ -61,6 +61,15 @@ #include <limits.h> #include <openssl/buffer.h> +size_t BUF_strnlen(const char *str, size_t maxlen) +{ + const char *p; + + for (p = str; maxlen-- != 0 && *p != '\0'; ++p) ; + + return p - str; +} + char *BUF_strdup(const char *str) { if (str == NULL) @@ -75,6 +84,8 @@ char *BUF_strndup(const char *str, size_t siz) if (str == NULL) return NULL; + siz = BUF_strnlen(str, siz); + if (siz >= INT_MAX) return NULL; |