From: Lukas Czerner <lczerner@redhat.com>
To: tytso@mit.edu
Cc: linux-ext4@vger.kernel.org
Subject: [PATCH 5/7] libss: handle memory allcation failure in ss_help()
Date: Fri, 6 Aug 2021 11:58:18 +0200 [thread overview]
Message-ID: <20210806095820.83731-5-lczerner@redhat.com> (raw)
In-Reply-To: <20210806095820.83731-1-lczerner@redhat.com>
Signed-off-by: Lukas Czerner <lczerner@redhat.com>
---
lib/ss/help.c | 7 ++++++-
1 file changed, 6 insertions(+), 1 deletion(-)
diff --git a/lib/ss/help.c b/lib/ss/help.c
index 96eb1092..a22b4017 100644
--- 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);
--
2.31.1
next prev parent reply other threads:[~2021-08-06 9:58 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-08-06 9:58 [PATCH 1/7] e2fsck: value stored to err is never read Lukas Czerner
2021-08-06 9:58 ` [PATCH 2/7] ext2fs: initialize retval before using it Lukas Czerner
2021-08-10 14:59 ` Theodore Ts'o
2021-08-06 9:58 ` [PATCH 3/7] e2fsprogs: fix unexpected NULL variable Lukas Czerner
2021-08-10 15:01 ` Theodore Ts'o
2021-08-06 9:58 ` [PATCH 4/7] e2fsprogs: remove augmented rbtree functionality Lukas Czerner
2021-08-10 15:01 ` Theodore Ts'o
2021-08-06 9:58 ` Lukas Czerner [this message]
2021-08-10 15:03 ` [PATCH 5/7] libss: handle memory allcation failure in ss_help() Theodore Ts'o
2021-08-06 9:58 ` [PATCH 6/7] libss: Add missing error handling for fdopen() Lukas Czerner
2021-08-10 15:03 ` Theodore Ts'o
2021-08-06 9:58 ` [PATCH 7/7] mkquota: Fix potental NULL pointer dereference Lukas Czerner
2021-08-10 16:15 ` Theodore Ts'o
2021-08-11 17:32 ` Lukas Czerner
2021-08-10 14:58 ` [PATCH 1/7] e2fsck: value stored to err is never read Theodore Ts'o
2021-08-11 17:33 ` Lukas Czerner
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20210806095820.83731-5-lczerner@redhat.com \
--to=lczerner@redhat.com \
--cc=linux-ext4@vger.kernel.org \
--cc=tytso@mit.edu \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).