aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorIan Kent <raven@themaw.net>2022-11-24 09:18:35 +0800
committerIan Kent <raven@themaw.net>2022-11-29 16:37:41 +0800
commitb6d4169a264d964b811fd8ff74e68145fc9a13de (patch)
treebc59ec1c300cac4a5a74043d5922a3b114e78b6a
parent145da73ca18178ee9b179310c6234b454abb1836 (diff)
downloadautofs-b6d4169a264d964b811fd8ff74e68145fc9a13de.tar.gz
autofs-5.1.8 - fix minus only option handling in concat_options()
While a '-' alone isn't strictly valid it hadn't previously cuased a parse error. So commit 9047e91ffa69 (autofs-5.1.7 - fix concat_options() error handling) introduced a regression by no longer allowing this. Fix this regression by only failing if errno is set to a non-zero value on return from concat_options() as well as returning NULL. Fixes: 9047e91ffa69 (autofs-5.1.7 - fix concat_options() error handling) Signed-off-by: Ian Kent <raven@themaw.net>
-rw-r--r--CHANGELOG1
-rw-r--r--modules/parse_sun.c25
2 files changed, 20 insertions, 6 deletions
diff --git a/CHANGELOG b/CHANGELOG
index e75f341f..f50f7c26 100644
--- a/CHANGELOG
+++ b/CHANGELOG
@@ -47,6 +47,7 @@
- fix hosts map deadlock on restart.
- fix deadlock with hosts map reload.
- fix memory leak in update_hosts_mounts().
+- fix minus only option handling in concat_options().
19/10/2021 autofs-5.1.8
- add xdr_exports().
diff --git a/modules/parse_sun.c b/modules/parse_sun.c
index 4d716b6f..759e580b 100644
--- a/modules/parse_sun.c
+++ b/modules/parse_sun.c
@@ -376,10 +376,16 @@ static int do_init(int argc, const char *const *argv, struct parse_context *ctxt
if (gbl_options) {
append_options = defaults_get_append_options();
if (append_options) {
- char *tmp = concat_options(gbl_options, ctxt->optstr);
+ char *tmp;
+
+ errno = 0;
+ tmp = concat_options(gbl_options, ctxt->optstr);
if (!tmp) {
- char *estr = strerror_r(errno, buf, MAX_ERR_BUF);
- logerr(MODPREFIX "concat_options: %s", estr);
+ /* Ignore non-error NULL return */
+ if (errno) {
+ char *estr = strerror_r(errno, buf, MAX_ERR_BUF);
+ logerr(MODPREFIX "concat_options: %s", estr);
+ }
/* freed in concat_options */
ctxt->optstr = NULL;
} else
@@ -1007,9 +1013,12 @@ static int parse_mapent(const char *ent, char *g_options, char **options, char *
free(myoptions);
myoptions = newopt;
} else if (newopt) {
+ errno = 0;
tmp = concat_options(myoptions, newopt);
- if (!tmp) {
+ /* Ignore non-error NULL return */
+ if (!tmp && errno) {
char *estr;
+
estr = strerror_r(errno, buf, MAX_ERR_BUF);
error(logopt, MODPREFIX
"concat_options: %s", estr);
@@ -1381,8 +1390,10 @@ dont_expand:
free(mnt_options);
mnt_options = noptions;
} else if (noptions) {
+ errno = 0;
tmp = concat_options(mnt_options, noptions);
- if (!tmp) {
+ /* Ignore non-error NULL return */
+ if (!tmp && errno) {
char *estr = strerror_r(errno, buf, MAX_ERR_BUF);
error(ap->logopt,
MODPREFIX "concat_options: %s", estr);
@@ -1406,8 +1417,10 @@ dont_expand:
free(options);
options = mnt_options;
} else if (mnt_options) {
+ errno = 0;
tmp = concat_options(options, mnt_options);
- if (!tmp) {
+ /* Ignore non-error NULL return */
+ if (!tmp && errno) {
char *estr = strerror_r(errno, buf, MAX_ERR_BUF);
error(ap->logopt, MODPREFIX "concat_options: %s", estr);
free(pmapent);