From 17517501c045fae6d349f9e0bfcfa23418a6bb68 Mon Sep 17 00:00:00 2001 From: xueyamao Date: Fri, 12 Aug 2022 10:41:17 +0800 Subject: [PATCH] Fix format-overflow warning rpc-pipefs-generator.c:35 sprintf: '%s' directive output between 0 and 2147483653 bytes may exceed minimum required size of 4095 [-Werror=format-overflow=] Signed-off-by: xueyamao --- 0005-Fix-format-overflow-warning.patch | 36 ++++++++++++++++++++++++++ nfs-utils.spec | 7 +++-- 2 files changed, 41 insertions(+), 2 deletions(-) create mode 100644 0005-Fix-format-overflow-warning.patch diff --git a/0005-Fix-format-overflow-warning.patch b/0005-Fix-format-overflow-warning.patch new file mode 100644 index 0000000..9b3c208 --- /dev/null +++ b/0005-Fix-format-overflow-warning.patch @@ -0,0 +1,36 @@ +From 7f8463fe702174bd613df9d308cc899af25ae02e Mon Sep 17 00:00:00 2001 +From: Steve Dickson +Date: Thu, 11 Aug 2022 11:15:15 +0800 +Subject: [PATCH] Fix format-overflow warning + +rpc-pipefs-generator.c:35:23: error: '%s' directive output between 0 and 2147483653 bytes may exceed minimum required size of 4095 [-Werror=format-overflow=] + 35 | sprintf(path, "%s/%s", dirname, pipefs_unit); + | ^ + +Signed-off-by: Steve Dickson +--- + systemd/rpc-pipefs-generator.c | 6 +++--- + 1 file changed, 3 insertions(+), 3 deletions(-) + +diff --git a/systemd/rpc-pipefs-generator.c b/systemd/rpc-pipefs-generator.c +index 8e218aa..801975c 100644 +--- a/systemd/rpc-pipefs-generator.c ++++ b/systemd/rpc-pipefs-generator.c +@@ -28,11 +28,11 @@ static int generate_mount_unit(const char *pipefs_path, const char *pipefs_unit, + { + char *path; + FILE *f; +- +- path = malloc(strlen(dirname) + 1 + strlen(pipefs_unit)); ++ size_t size = (strlen(dirname) + 1 + strlen(pipefs_unit)); ++ path = malloc(size); + if (!path) + return 1; +- sprintf(path, "%s/%s", dirname, pipefs_unit); ++ snprintf(path, size, "%s/%s", dirname, pipefs_unit); + f = fopen(path, "w"); + if (!f) + { +-- +2.33.0 + diff --git a/nfs-utils.spec b/nfs-utils.spec index 03ddd87..97a5aab 100644 --- a/nfs-utils.spec +++ b/nfs-utils.spec @@ -4,7 +4,7 @@ Name: nfs-utils Version: 2.5.4 -Release: 6 +Release: 7 Epoch: 2 Summary: The Linux NFS userland utility package License: MIT and GPLv2 and GPLv2+ and BSD @@ -17,7 +17,7 @@ Patch1: 0001-correct-the-statd-path-in-man.patch Patch2: 0002-nfs-utils-set-use-gss-proxy-1-to-enable-gss-proxy-by.patch Patch3: 0003-idmapd-Fix-error-status-when-nfs-idmapd-exits.patch Patch4: 0004-fix-coredump-in-bl_add_disk.patch - +Patch5: 0005-Fix-format-overflow-warning.patch BuildRequires: libevent-devel,libcap-devel, libtirpc-devel libblkid-devel BuildRequires: krb5-libs >= 1.4 autoconf >= 2.57 openldap-devel >= 2.2 BuildRequires: automake, libtool, gcc, device-mapper-devel @@ -228,6 +228,9 @@ fi %{_mandir}/*/* %changelog +* Thu Aug 11 2022 xueyamao - 2:2.5.4-7 +- systemd: Fix format-overflow warning. + * Sat Apr 16 2022 Wu Bo - 2.5.4-6 - Update epoch version to 2. In order to fix the upgrade issues. -- Gitee