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

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