diff options
Diffstat (limited to 'crypto/buffer')
-rw-r--r-- | crypto/buffer/buf_str.c | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/crypto/buffer/buf_str.c b/crypto/buffer/buf_str.c index 11241f8727..a464eb6e25 100644 --- a/crypto/buffer/buf_str.c +++ b/crypto/buffer/buf_str.c @@ -71,9 +71,14 @@ char *BUF_strdup(const char *str) char *BUF_strndup(const char *str, size_t siz) { char *ret; + size_t len; if (str == NULL) return(NULL); + len = strlen(str); + if (siz > len) + siz = len; + ret=OPENSSL_malloc(siz+1); if (ret == NULL) { |