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

40 lines
1.2 KiB
Diff
Raw Normal View History

autofs-5.1.5 - add NULL check for get_addr_string() return
From: Ian Kent <raven@themaw.net>
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@themaw.net>
---
CHANGELOG | 1 +
modules/mount_nfs.c | 6 ++++++
2 files changed, 7 insertions(+)
--- autofs-5.1.4.orig/CHANGELOG
+++ autofs-5.1.4/CHANGELOG
@@ -45,6 +45,7 @@ xx/xx/2018 autofs-5.1.5
- move close stdio descriptors to become_daemon().
- add systemd service command line option.
- support strictexpire mount option.
+- add NULL check for get_addr_string() return.
19/12/2017 autofs-5.1.4
- fix spec file url.
--- autofs-5.1.4.orig/modules/mount_nfs.c
+++ autofs-5.1.4/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);