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:
2a2edef
)
libss: handle memory allcation failure in ss_help()
author
Lukas Czerner
<lczerner@redhat.com>
Fri, 6 Aug 2021 09:58:18 +0000
(11:58 +0200)
committer
Theodore Ts'o
<tytso@mit.edu>
Tue, 10 Aug 2021 15:02:57 +0000
(11:02 -0400)
Signed-off-by: Lukas Czerner <lczerner@redhat.com>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
lib/ss/help.c
patch
|
blob
|
history
diff --git
a/lib/ss/help.c
b/lib/ss/help.c
index
96eb109
..
a22b401
100644
(file)
--- a/
lib/ss/help.c
+++ b/
lib/ss/help.c
@@
-96,7
+96,12
@@
void ss_help(int argc, char const * const *argv, int sci_idx, pointer info_ptr)
}
if (fd < 0) {
#define MSG "No info found for "
- char *buf = malloc(strlen (MSG) + strlen (argv[1]) + 1);
+ char *buf = malloc(strlen (MSG) + strlen (argv[1]) + 1);
+ if (!buf) {
+ ss_perror(sci_idx, 0,
+ "couldn't allocate memory to print error message");
+ return;
+ }
strcpy(buf, MSG);
strcat(buf, argv[1]);
ss_perror(sci_idx, 0, buf);