[PATCH 3/9] autofs-5.1.5 - add NULL check for get_addr_string() return

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



When constructing the mount location string in mount_nfs.c:mount_mount()
the return from get_addr_string() is not checked for NULL.

Signed-off-by: Ian Kent <raven@xxxxxxxxxx>
---
 CHANGELOG           |    1 +
 modules/mount_nfs.c |    6 ++++++
 2 files changed, 7 insertions(+)

diff --git a/CHANGELOG b/CHANGELOG
index 76da2ee4..e71e913a 100644
--- a/CHANGELOG
+++ b/CHANGELOG
@@ -1,6 +1,7 @@
 xx/xx/2019 autofs-5.1.6
 - support strictexpire mount option.
 - fix hesiod string check in master_parse().
+- add NULL check for get_addr_string() return.
 
 30/10/2018 autofs-5.1.5
 - fix flag file permission.
diff --git a/modules/mount_nfs.c b/modules/mount_nfs.c
index 426c27bd..295c4a5d 100644
--- a/modules/mount_nfs.c
+++ b/modules/mount_nfs.c
@@ -333,7 +333,13 @@ dont_probe:
 			socklen_t len = INET6_ADDRSTRLEN;
 			char n_buf[len + 1];
 			const char *n_addr;
+
 			n_addr = get_addr_string(this->addr, n_buf, len);
+			if (!n_addr) {
+				char *estr = strerror_r(errno, buf, MAX_ERR_BUF);
+				error(ap->logopt, "get_addr_string: %s", estr);
+				goto forced_fail;
+			}
 			loc = malloc(strlen(n_addr) + strlen(this->path) + 4);
 			if (!loc) {
 				char *estr = strerror_r(errno, buf, MAX_ERR_BUF);




[Index of Archives]     [Linux Filesystem Development]     [Linux Ext4]     [Linux ARM Kernel]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [IETF Annouce]     [Security]     [Bugtraq]     [Linux]     [Linux OMAP]     [Linux MIPS]     [ECOS]     [Asterisk Internet PBX]     [Linux API]

  Powered by Linux