projects
/
oweals
/
openssl.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
dcca7b1
)
Don't allocate more than is needed in BUF_strndup().
author
Ben Laurie
<ben@links.org>
Tue, 20 May 2014 12:52:31 +0000
(13:52 +0100)
committer
Ben Laurie
<ben@links.org>
Tue, 20 May 2014 12:52:31 +0000
(13:52 +0100)
crypto/buffer/buf_str.c
patch
|
blob
|
history
diff --git
a/crypto/buffer/buf_str.c
b/crypto/buffer/buf_str.c
index 11241f87273a532dc0ac6d1ac6337a95d5346905..a464eb6e25605eb71df850ebba1c8f45f7a39628 100644
(file)
--- 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)
{