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:
a6aee13
)
ext2ed: fix potential NULL pointer dereference in dupstr()
author
Zhiqiang Liu
<liuzhiqiang26@huawei.com>
Wed, 30 Jun 2021 08:27:24 +0000
(16:27 +0800)
committer
Theodore Ts'o
<tytso@mit.edu>
Fri, 16 Jul 2021 03:59:21 +0000
(23:59 -0400)
In dupstr(), we should check return value of malloc().
Signed-off-by: Zhiqiang Liu <liuzhiqiang26@huawei.com>
Signed-off-by: Wu Guanghao <wuguanghao3@huawei.com>
Reviewed-by: Wu Bo <wubo40@huawei.com>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
ext2ed/main.c
patch
|
blob
|
history
diff --git
a/ext2ed/main.c
b/ext2ed/main.c
index
f7e7d7d
..
9d33a8e
100644
(file)
--- a/
ext2ed/main.c
+++ b/
ext2ed/main.c
@@
-524,6
+524,8
@@
char *dupstr (char *src)
char *ptr;
ptr=(char *) malloc (strlen (src)+1);
+ if (!ptr)
+ return NULL;
strcpy (ptr,src);
return (ptr);
}