From: Vivek Trivedi <t.vivek@samsung.com>
To: linux-nfs@vger.kernel.org
Cc: a.sahrawat@samsung.com, pankaj.m@samsung.com,
Vivek Trivedi <t.vivek@samsung.com>
Subject: [PATCH 2/2] nfs-utils: mount.nfs: fix null pointer derefernce in nfs_parse_simple_hostname
Date: Wed, 02 Dec 2015 16:46:38 +0530 [thread overview]
Message-ID: <1449054998-19308-2-git-send-email-t.vivek@samsung.com> (raw)
In-Reply-To: <1449054998-19308-1-git-send-email-t.vivek@samsung.com>
In function nfs_parse_simple_hostname, hostname can be NULL,
dereferncing it while passing it to free(*hostname) may result in segfault.
Signed-off-by: Vivek Trivedi <t.vivek@samsung.com>
---
utils/mount/parse_dev.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/utils/mount/parse_dev.c b/utils/mount/parse_dev.c
index d64b83d..0d3bcb9 100644
--- a/utils/mount/parse_dev.c
+++ b/utils/mount/parse_dev.c
@@ -118,7 +118,8 @@ static int nfs_parse_simple_hostname(const char *dev,
if (pathname) {
*pathname = strndup(colon, path_len);
if (*pathname == NULL) {
- free(*hostname);
+ if (hostname)
+ free(*hostname);
return nfs_pdn_nomem_err();
}
}
--
1.7.9.5
next prev parent reply other threads:[~2015-12-02 11:18 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-12-02 11:16 [PATCH 1/2] nfs-utils: libnsm.a: do not close file if open failed Vivek Trivedi
2015-12-02 11:16 ` Vivek Trivedi [this message]
2015-12-02 16:16 ` [PATCH 2/2] nfs-utils: mount.nfs: fix null pointer derefernce in nfs_parse_simple_hostname Steve Dickson
2015-12-03 15:22 ` Vivek Trivedi
2015-12-12 12:12 ` Steve Dickson
2015-12-02 16:11 ` [PATCH 1/2] nfs-utils: libnsm.a: do not close file if open failed Steve Dickson
2015-12-03 15:21 ` Vivek Trivedi
2015-12-12 12:11 ` Steve Dickson
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=1449054998-19308-2-git-send-email-t.vivek@samsung.com \
--to=t.vivek@samsung.com \
--cc=a.sahrawat@samsung.com \
--cc=linux-nfs@vger.kernel.org \
--cc=pankaj.m@samsung.com \
/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