Whamcloud - gitweb
git://git.whamcloud.com
/
tools
/
e2fsprogs.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
0afb9be
)
libext2fs: fix uninitialized length in rep_strdup()
author
Theodore Ts'o
<tytso@mit.edu>
Sat, 18 Aug 2018 17:29:41 +0000
(13:29 -0400)
committer
Theodore Ts'o
<tytso@mit.edu>
Sat, 18 Aug 2018 17:32:25 +0000
(13:32 -0400)
For platforms whose libc don't supply strdup(), the replacement strdup
function in lib/ext2fs/tdb.c needs to always initialize the length
variable.
Reported-by: Vladyslav Tsilytskyi <ykp@protonmail.ch>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
lib/ext2fs/tdb.c
patch
|
blob
|
history
diff --git
a/lib/ext2fs/tdb.c
b/lib/ext2fs/tdb.c
index
195a4c0
..
5091b12
100644
(file)
--- a/
lib/ext2fs/tdb.c
+++ b/
lib/ext2fs/tdb.c
@@
-79,12
+79,10
@@
static char *rep_strdup(const char *s)
{
char *ret;
int length;
+
if (!s)
return NULL;
-
- if (!length)
- length = strlen(s);
-
+ length = strlen(s);
ret = malloc(length + 1);
if (ret) {
strncpy(ret, s, length);