projects
/
platform
/
upstream
/
llvm.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
f35d482
)
[libc][Obvious] Fix an off-by-one error introduced by eb9cc253cb048b6dbf2fcd73ac55b5e...
author
Siva Chandra Reddy
<sivachandra@google.com>
Wed, 21 Dec 2022 21:10:42 +0000
(21:10 +0000)
committer
Siva Chandra Reddy
<sivachandra@google.com>
Wed, 21 Dec 2022 21:11:08 +0000
(21:11 +0000)
libc/src/string/strndup.cpp
patch
|
blob
|
history
diff --git
a/libc/src/string/strndup.cpp
b/libc/src/string/strndup.cpp
index
9a8d414
..
bf766e7
100644
(file)
--- a/
libc/src/string/strndup.cpp
+++ b/
libc/src/string/strndup.cpp
@@
-24,7
+24,7
@@
LLVM_LIBC_FUNCTION(char *, strndup, (const char *src, size_t size)) {
if (len > size)
len = size;
AllocChecker ac;
- char *dest = new (ac) char[len];
+ char *dest = new (ac) char[len
+ 1
];
if (!ac)
return nullptr;
inline_memcpy(dest, src, len + 1);