mount.nfs: fix NULL pointer derefernce in nfs_parse_square_bracket (bz 2136807)

Signed-off-by: Steve Dickson <steved@redhat.com>
Resolves: bz2136807
This commit is contained in:
Steve Dickson 2022-11-14 15:26:05 -05:00
parent d3d33b866a
commit 63be7eff36
2 changed files with 29 additions and 0 deletions

View File

@ -0,0 +1,27 @@
commit ea536a2e641664c8ea439e5e571e757785f587c9
Author: Zhi Li <yieli@redhat.com>
Date: Mon Oct 24 13:31:41 2022 -0400
mount.nfs: fix NULL pointer derefernce in nfs_parse_square_bracket
In function nfs_parse_square_bracket, hostname could be NULL,
dereferencing it in free(*hostname) may cause an unexpected segfault.
Fixes: https://bugzilla.redhat.com/show_bug.cgi?id=2136807
Signed-off-by: Zhi Li <yieli@redhat.com>
Signed-off-by: Steve Dickson <steved@redhat.com>
diff --git a/utils/mount/parse_dev.c b/utils/mount/parse_dev.c
index 0d3bcb95..2ade5d5d 100644
--- a/utils/mount/parse_dev.c
+++ b/utils/mount/parse_dev.c
@@ -170,7 +170,8 @@ static int nfs_parse_square_bracket(const char *dev,
if (pathname) {
*pathname = strndup(cbrace, path_len);
if (*pathname == NULL) {
- free(*hostname);
+ if (hostname)
+ free(*hostname);
return nfs_pdn_nomem_err();
}
}

View File

@ -38,6 +38,7 @@ Patch012: nfs-utils-2.5.4-systemd-rpcstatd.patch
# RHEL9.2
#
Patch013: nfs-utils-2.5.4-nfsd-man-4vers.patch
Patch014: nfs-utils-2.5.4-mount-null-ptr.patch
Patch100: nfs-utils-1.2.1-statdpath-man.patch
Patch101: nfs-utils-1.2.1-exp-subtree-warn-off.patch
@ -473,6 +474,7 @@ fi
%changelog
* Mon Nov 14 2022 Steve Dickson <steved@redhat.com> 2.5.4-16
- nfsd.man: Explain that setting nfsv4=n turns off all v4 versions (bz 2042362)
- mount.nfs: fix NULL pointer derefernce in nfs_parse_square_bracket (bz 2136807)
* Thu Aug 18 2022 Steve Dickson <steved@redhat.com> 2.5.4-15
- Fix uninstall warnings (bz 2048023)