From 68e7571feb5bc617042b3f77635e4cc23f6367eb Mon Sep 17 00:00:00 2001 From: Steve Dickson Date: Mon, 13 Feb 2023 07:59:04 -0500 Subject: [PATCH] Covscan Scan: Wrong Check of Return Value (bz 2151968) Signed-off-by: Steve Dickson Resolves: bz2151968 --- nfs-utils-2.5.4-covscan-return-value.patch | 25 ++++++++++++++++++++++ nfs-utils.spec | 6 +++++- 2 files changed, 30 insertions(+), 1 deletion(-) create mode 100644 nfs-utils-2.5.4-covscan-return-value.patch diff --git a/nfs-utils-2.5.4-covscan-return-value.patch b/nfs-utils-2.5.4-covscan-return-value.patch new file mode 100644 index 0000000..0d3088a --- /dev/null +++ b/nfs-utils-2.5.4-covscan-return-value.patch @@ -0,0 +1,25 @@ +diff -up nfs-utils-2.5.4/support/export/client.c.orig nfs-utils-2.5.4/support/export/client.c +--- nfs-utils-2.5.4/support/export/client.c.orig 2021-06-10 14:07:47.000000000 -0400 ++++ nfs-utils-2.5.4/support/export/client.c 2023-01-26 11:26:00.279342412 -0500 +@@ -699,6 +699,9 @@ check_netgroup(const nfs_client *clp, co + + /* check whether the IP itself is in the netgroup */ + ip = calloc(INET6_ADDRSTRLEN, 1); ++ if (ip == NULL) ++ goto out; ++ + if (inet_ntop(ai->ai_family, &(((struct sockaddr_in *)ai->ai_addr)->sin_addr), ip, INET6_ADDRSTRLEN) == ip) { + if (innetgr(netgroup, ip, NULL, NULL)) { + free(hname); +diff -up nfs-utils-2.5.4/tools/nfsrahead/main.c.orig nfs-utils-2.5.4/tools/nfsrahead/main.c +--- nfs-utils-2.5.4/tools/nfsrahead/main.c.orig 2023-01-26 11:23:48.941618287 -0500 ++++ nfs-utils-2.5.4/tools/nfsrahead/main.c 2023-01-26 11:26:00.279342412 -0500 +@@ -167,7 +167,7 @@ int main(int argc, char **argv) + if ((ret = get_device_info(argv[optind], &device)) == 0) + break; + +- if (ret != 0) { ++ if (ret != 0 || device.fstype == NULL) { + xlog(D_GENERAL, "unable to find device %s\n", argv[optind]); + goto out; + } diff --git a/nfs-utils.spec b/nfs-utils.spec index 0123825..5ff78bc 100644 --- a/nfs-utils.spec +++ b/nfs-utils.spec @@ -2,7 +2,7 @@ Summary: NFS utilities and supporting clients and daemons for the kernel NFS ser Name: nfs-utils URL: http://linux-nfs.org/ Version: 2.5.4 -Release: 17%{?dist} +Release: 18%{?dist} Epoch: 1 # group all 32bit related archs @@ -40,6 +40,7 @@ Patch012: nfs-utils-2.5.4-systemd-rpcstatd.patch Patch013: nfs-utils-2.5.4-nfsd-man-4vers.patch Patch014: nfs-utils-2.5.4-mount-null-ptr.patch Patch015: nfs-utils-2.5.4-nfsrahead-cmd.patch +Patch016: nfs-utils-2.5.4-covscan-return-value.patch Patch100: nfs-utils-1.2.1-statdpath-man.patch Patch101: nfs-utils-1.2.1-exp-subtree-warn-off.patch @@ -481,6 +482,9 @@ fi %{_mandir}/*/nfsiostat.8.gz %changelog +* Thu Jan 26 2023 Steve Dickson 2.5.4-18 +- Covscan Scan: Wrong Check of Return Value (bz 2151968) + * Thu Dec 1 2022 Steve Dickson 2.5.4-17 - Create the nfsrahead command (bz 2143747)