From 0bb27b7d95096a5124a7ebf02d450daac0eb76ff Mon Sep 17 00:00:00 2001 From: Ian Kent Date: Fri, 2 Jul 2021 08:04:24 +0800 Subject: [PATCH] - correct patch, fix concat_options() error handling for bug 1938682. --- ....7-fix-concat_options-error-handling.patch | 19 ++++++++++--------- autofs.spec | 8 +++++++- 2 files changed, 17 insertions(+), 10 deletions(-) diff --git a/autofs-5.1.7-fix-concat_options-error-handling.patch b/autofs-5.1.7-fix-concat_options-error-handling.patch index 861b734..4b837f4 100644 --- a/autofs-5.1.7-fix-concat_options-error-handling.patch +++ b/autofs-5.1.7-fix-concat_options-error-handling.patch @@ -16,8 +16,8 @@ handling can be consistent in all places. Signed-off-by: Ian Kent --- 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 - 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 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 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 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 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; diff --git a/autofs.spec b/autofs.spec index 4632fac..bb875c0 100644 --- a/autofs.spec +++ b/autofs.spec @@ -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 - 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 - 1:5.1.7-20 - bz1938682 - review of important potential issues detected by static analyzers in autofs-5.1.7-2.el9