Blame SOURCES/autofs-5.1.5-add-NULL-check-for-get_addr_string-return.patch

c3f1f8
autofs-5.1.5 - add NULL check for get_addr_string() return
c3f1f8
c3f1f8
From: Ian Kent <raven@themaw.net>
c3f1f8
c3f1f8
When constructing the mount location string in mount_nfs.c:mount_mount()
c3f1f8
the return from get_addr_string() is not checked for NULL.
c3f1f8
c3f1f8
Signed-off-by: Ian Kent <raven@themaw.net>
c3f1f8
---
c3f1f8
 CHANGELOG           |    1 +
c3f1f8
 modules/mount_nfs.c |    6 ++++++
c3f1f8
 2 files changed, 7 insertions(+)
c3f1f8
c3f1f8
--- autofs-5.1.4.orig/CHANGELOG
c3f1f8
+++ autofs-5.1.4/CHANGELOG
c3f1f8
@@ -45,6 +45,7 @@ xx/xx/2018 autofs-5.1.5
c3f1f8
 - move close stdio descriptors to become_daemon().
c3f1f8
 - add systemd service command line option.
c3f1f8
 - support strictexpire mount option.
c3f1f8
+- add NULL check for get_addr_string() return.
c3f1f8
 
c3f1f8
 19/12/2017 autofs-5.1.4
c3f1f8
 - fix spec file url.
c3f1f8
--- autofs-5.1.4.orig/modules/mount_nfs.c
c3f1f8
+++ autofs-5.1.4/modules/mount_nfs.c
c3f1f8
@@ -333,7 +333,13 @@ dont_probe:
c3f1f8
 			socklen_t len = INET6_ADDRSTRLEN;
c3f1f8
 			char n_buf[len + 1];
c3f1f8
 			const char *n_addr;
c3f1f8
+
c3f1f8
 			n_addr = get_addr_string(this->addr, n_buf, len);
c3f1f8
+			if (!n_addr) {
c3f1f8
+				char *estr = strerror_r(errno, buf, MAX_ERR_BUF);
c3f1f8
+				error(ap->logopt, "get_addr_string: %s", estr);
c3f1f8
+				goto forced_fail;
c3f1f8
+			}
c3f1f8
 			loc = malloc(strlen(n_addr) + strlen(this->path) + 4);
c3f1f8
 			if (!loc) {
c3f1f8
 				char *estr = strerror_r(errno, buf, MAX_ERR_BUF);