- correct patch, fix concat_options() error handling for bug 1938682.

This commit is contained in:
Ian Kent 2021-07-02 08:04:24 +08:00
parent 51e42820d4
commit 0bb27b7d95
2 changed files with 17 additions and 10 deletions

View File

@ -16,8 +16,8 @@ handling can be consistent in all places.
Signed-off-by: Ian Kent <raven@themaw.net>
---
CHANGELOG | 1 +
modules/parse_sun.c | 23 +++++++++++------------
2 files changed, 12 insertions(+), 12 deletions(-)
modules/parse_sun.c | 24 +++++++++++-------------
2 files changed, 12 insertions(+), 13 deletions(-)
--- autofs-5.1.7.orig/CHANGELOG
+++ autofs-5.1.7/CHANGELOG
@ -31,16 +31,17 @@ Signed-off-by: Ian Kent <raven@themaw.net>
- make bind mounts propagation slave by default.
--- autofs-5.1.7.orig/modules/parse_sun.c
+++ autofs-5.1.7/modules/parse_sun.c
@@ -381,6 +381,8 @@ static int do_init(int argc, const char
@@ -380,7 +380,8 @@ static int do_init(int argc, const char
if (!tmp) {
char *estr = strerror_r(errno, buf, MAX_ERR_BUF);
logerr(MODPREFIX "concat_options: %s", estr);
free(gbl_options);
- free(gbl_options);
+ /* freed in concat_options */
+ ctxt->optstr = NULL;
} else
ctxt->optstr = tmp;
} else {
@@ -492,12 +494,16 @@ static char *concat_options(char *left,
@@ -492,12 +493,16 @@ static char *concat_options(char *left,
char *ret;
if (left == NULL || *left == '\0') {
@ -57,7 +58,7 @@ Signed-off-by: Ian Kent <raven@themaw.net>
ret = strdup(left);
free(left);
return ret;
@@ -508,6 +514,8 @@ static char *concat_options(char *left,
@@ -508,6 +513,8 @@ static char *concat_options(char *left,
if (ret == NULL) {
char *estr = strerror_r(errno, buf, MAX_ERR_BUF);
logerr(MODPREFIX "malloc: %s", estr);
@ -66,7 +67,7 @@ Signed-off-by: Ian Kent <raven@themaw.net>
return NULL;
}
@@ -989,14 +997,13 @@ static int parse_mapent(const char *ent,
@@ -989,14 +996,13 @@ static int parse_mapent(const char *ent,
if (newopt && strstr(newopt, myoptions)) {
free(myoptions);
myoptions = newopt;
@ -82,7 +83,7 @@ Signed-off-by: Ian Kent <raven@themaw.net>
return 0;
}
myoptions = tmp;
@@ -1358,16 +1365,12 @@ dont_expand:
@@ -1358,16 +1364,12 @@ dont_expand:
if (mnt_options && noptions && strstr(noptions, mnt_options)) {
free(mnt_options);
mnt_options = noptions;
@ -100,7 +101,7 @@ Signed-off-by: Ian Kent <raven@themaw.net>
free(options);
free(pmapent);
return 1;
@@ -1387,15 +1390,11 @@ dont_expand:
@@ -1387,15 +1389,11 @@ dont_expand:
if (options && mnt_options && strstr(mnt_options, options)) {
free(options);
options = mnt_options;

View File

@ -12,7 +12,7 @@
Summary: A tool for automatically mounting and unmounting filesystems
Name: autofs
Version: 5.1.7
Release: 20%{?dist}
Release: 21%{?dist}
Epoch: 1
License: GPLv2+
Source: https://www.kernel.org/pub/linux/daemons/autofs/v5/autofs-%{version}-2.tar.gz
@ -352,6 +352,12 @@ fi
%dir /etc/auto.master.d
%changelog
* Fri Jul 02 2021 Ian Kent <ikent@redhat.com> - 1:5.1.7-21
- bz1938682 - review of important potential issues detected by static analyzers
in autofs-5.1.7-2.el9
- correct patch, fix concat_options() error handling.
- Related: rhbz#1938682
* Wed Jun 30 2021 Ian Kent <ikent@redhat.com> - 1:5.1.7-20
- bz1938682 - review of important potential issues detected by static analyzers
in autofs-5.1.7-2.el9