Fixed findings

List of Findings

Error: COMPILER_WARNING (CWE-126): [#def1]
nfs-utils-2.8.7/support/nfs/getport.c:459:24: warning[-Wstringop-overread]: 'strndup' specified bound 108 exceeds source size 14
#  459 |                 return strndup(sun->sun_path, sizeof(sun->sun_path));
#      |                        ^
nfs-utils-2.8.7/support/nfs/getport.c: scope_hint: In function 'main'
nfs-utils-2.8.7/support/nfs/getport.c:1119:28: note: source object allocated here
# 1119 |         struct sockaddr_in addr = {
#      |                            ^
#  457|   	switch (sap->sa_family) {
#  458|   	case AF_LOCAL:
#  459|-> 		return strndup(sun->sun_path, sizeof(sun->sun_path));
#  460|   	case AF_INET:
#  461|   		if (inet_ntop(AF_INET, (const void *)&sin->sin_addr.s_addr,

Error: COMPILER_WARNING (CWE-126): [#def2]
nfs-utils-2.8.7/support/nfs/getport.c:459:24: warning[-Wstringop-overread]: 'strndup' specified bound 108 exceeds source size 26
#  459 |                 return strndup(sun->sun_path, sizeof(sun->sun_path));
#      |                        ^
nfs-utils-2.8.7/support/nsm/rpc.c: scope_hint: In function 'nsm_xmit_getaddr.constprop'
nfs-utils-2.8.7/support/nsm/rpc.c:231:29: note: source object allocated here
#  231 |         struct sockaddr_in6 addr;
#      |                             ^
#  457|   	switch (sap->sa_family) {
#  458|   	case AF_LOCAL:
#  459|-> 		return strndup(sun->sun_path, sizeof(sun->sun_path));
#  460|   	case AF_INET:
#  461|   		if (inet_ntop(AF_INET, (const void *)&sin->sin_addr.s_addr,

Error: GCC_ANALYZER_WARNING (CWE-122): [#def3]
nfs-utils-2.8.7/support/nfsidmap/libnfsidmap.c:420:33: warning[-Wanalyzer-out-of-bounds]: heap-based buffer overflow
nfs-utils-2.8.7/support/nfsidmap/libnfsidmap.c:407:12: branch_false: following 'false' branch...
nfs-utils-2.8.7/support/nfsidmap/libnfsidmap.c:409:13: branch_false: ...to here
nfs-utils-2.8.7/support/nfsidmap/libnfsidmap.c:409:12: branch_true: following 'true' branch...
nfs-utils-2.8.7/support/nfsidmap/libnfsidmap.c:415:25: branch_true: ...to here
nfs-utils-2.8.7/support/nfsidmap/libnfsidmap.c:415:25: branch_false: following 'false' branch (when 'r' is NULL)...
nfs-utils-2.8.7/support/nfsidmap/libnfsidmap.c:418:31: branch_false: ...to here
nfs-utils-2.8.7/support/nfsidmap/libnfsidmap.c:419:28: branch_true: following 'true' branch (when 'buf' is non-NULL)...
nfs-utils-2.8.7/support/nfsidmap/libnfsidmap.c:420:33: branch_true: ...to here
nfs-utils-2.8.7/support/nfsidmap/libnfsidmap.c:420:33: danger: out-of-bounds write at byte 0 but region ends at byte 0
#  418|   			buf = malloc(siz);
#  419|   			if (buf) {
#  420|-> 				*buf = 0;
#  421|   				TAILQ_FOREACH(r, &local_realms->fields, link) {
#  422|   					sprintf(buf+strlen(buf), "'%s' ", r->field);

Error: COMPILER_WARNING (CWE-563): [#def4]
nfs-utils-2.8.7/utils/nfsdctl/nfsdctl.c: scope_hint: In function ‘netlink_msg_alloc’
nfs-utils-2.8.7/utils/nfsdctl/nfsdctl.c:444:13: warning[-Wunused-variable]: unused variable ‘id’
#  444 |         int id;
#      |             ^~
#  442|   {
#  443|   	struct nl_msg *msg;
#  444|-> 	int id;
#  445|   
#  446|   	msg = nlmsg_alloc();

Error: COMPILER_WARNING (CWE-252): [#def5]
nfs-utils-2.8.7/utils/nfsdctl/nfsdctl.c: scope_hint: In function ‘lockd_nl_family_setup’
nfs-utils-2.8.7/utils/nfsdctl/nfsdctl.c:477:25: warning[-Wunused-result]: ignoring return value of ‘system’ declared with attribute ‘warn_unused_result’
#  477 |                         system("modprobe lockd");
#      |                         ^~~~~~~~~~~~~~~~~~~~~~~~
#  475|   		lockd_nl_family = resolve_family(sock, LOCKD_FAMILY_NAME, L_WARNING);
#  476|   		if (lockd_nl_family) {
#  477|-> 			system("modprobe lockd");
#  478|   			lockd_nl_family = resolve_family(sock, LOCKD_FAMILY_NAME, L_ERROR);
#  479|   		}

Error: COMPILER_WARNING (CWE-252): [#def6]
nfs-utils-2.8.7/utils/nfsdctl/nfsdctl.c: scope_hint: In function ‘nfsd_nl_family_setup’
nfs-utils-2.8.7/utils/nfsdctl/nfsdctl.c:489:25: warning[-Wunused-result]: ignoring return value of ‘system’ declared with attribute ‘warn_unused_result’
#  489 |                         system("modprobe nfsd");
#      |                         ^~~~~~~~~~~~~~~~~~~~~~~
#  487|   		nfsd_nl_family = resolve_family(sock, NFSD_FAMILY_NAME, L_WARNING);
#  488|   		if (!nfsd_nl_family) {
#  489|-> 			system("modprobe nfsd");
#  490|   			nfsd_nl_family = resolve_family(sock, NFSD_FAMILY_NAME, L_ERROR);
#  491|   		}

Error: COMPILER_WARNING (CWE-563): [#def7]
nfs-utils-2.8.7/utils/nfsdctl/nfsdctl.c: scope_hint: In function ‘getpolicy_handler’
nfs-utils-2.8.7/utils/nfsdctl/nfsdctl.c:504:27: warning[-Wunused-variable]: unused variable ‘index’
#  504 |                 int i, j, index;
#      |                           ^~~~~
#  502|   	nla_for_each_attr(attr, genlmsg_attrdata(gnlh, 0), genlmsg_attrlen(gnlh, 0), rem) {
#  503|   		struct nlattr *a, *b;
#  504|-> 		int i, j, index;
#  505|   
#  506|   		if (nla_type(attr) == CTRL_ATTR_POLICY) {

Error: COMPILER_WARNING (CWE-563): [#def8]
nfs-utils-2.8.7/utils/nfsdctl/nfsdctl.c:526:13: warning[-Wunused-variable]: unused variable ‘opt’
#  526 |         int opt, ret, id;
#      |             ^~~
#  524|   	struct nl_msg *msg;
#  525|   	struct nl_cb *cb;
#  526|-> 	int opt, ret, id;
#  527|   
#  528|   	if (!nfsd_nl_family_setup(sock))

Error: COMPILER_WARNING (CWE-563): [#def9]
nfs-utils-2.8.7/utils/nfsdctl/nfsdctl.c: scope_hint: In function ‘query_nfsd_nl_policy’
nfs-utils-2.8.7/utils/nfsdctl/nfsdctl.c:526:23: warning[-Wunused-variable]: unused variable ‘id’
#  526 |         int opt, ret, id;
#      |                       ^~
#  524|   	struct nl_msg *msg;
#  525|   	struct nl_cb *cb;
#  526|-> 	int opt, ret, id;
#  527|   
#  528|   	if (!nfsd_nl_family_setup(sock))

Scan Properties

analyzer-version-clippy1.95.0
analyzer-version-cppcheck2.20.0
analyzer-version-gcc16.1.1
analyzer-version-gcc-analyzer16.1.1
analyzer-version-shellcheck0.11.0
analyzer-version-unicontrol0.0.2
diffbase-analyzer-version-clippy1.95.0
diffbase-analyzer-version-cppcheck2.20.0
diffbase-analyzer-version-gcc16.1.1
diffbase-analyzer-version-gcc-analyzer16.1.1
diffbase-analyzer-version-shellcheck0.11.0
diffbase-analyzer-version-unicontrol0.0.2
diffbase-enabled-pluginsclippy, cppcheck, gcc, shellcheck, unicontrol
diffbase-exit-code0
diffbase-hostip-172-16-1-137.us-west-2.compute.internal
diffbase-known-false-positives/usr/share/csmock/known-false-positives.js
diffbase-known-false-positives-rpmknown-false-positives-0.0.0.20260524.213755.g3c6d0be.main-1.el9.noarch
diffbase-mock-configfedora-rawhide-x86_64
diffbase-project-namenfs-utils-2.9.1-3.rc4.fc45
diffbase-store-results-to/tmp/tmptxyfved9/nfs-utils-2.9.1-3.rc4.fc45.tar.xz
diffbase-time-created2026-06-01 15:13:50
diffbase-time-finished2026-06-01 15:16:00
diffbase-toolcsmock
diffbase-tool-args'/usr/bin/csmock' '-r' 'fedora-rawhide-x86_64' '-t' 'shellcheck,cppcheck,clippy,unicontrol,gcc' '-o' '/tmp/tmptxyfved9/nfs-utils-2.9.1-3.rc4.fc45.tar.xz' '--gcc-analyze' '--unicontrol-notests' '--unicontrol-bidi-only' '--install' 'pam' '--gcc-analyzer-bin=/usr/bin/gcc' '/tmp/tmptxyfved9/nfs-utils-2.9.1-3.rc4.fc45.src.rpm'
diffbase-tool-versioncsmock-3.8.5.20260529.133039.g6f3b5c6-1.el9
enabled-pluginsclippy, cppcheck, gcc, shellcheck, unicontrol
exit-code0
hostip-172-16-1-137.us-west-2.compute.internal
known-false-positives/usr/share/csmock/known-false-positives.js
known-false-positives-rpmknown-false-positives-0.0.0.20260524.213755.g3c6d0be.main-1.el9.noarch
mock-configfedora-rawhide-x86_64
project-namenfs-utils-2.8.7-0.fc44
store-results-to/tmp/tmpgocehwmg/nfs-utils-2.8.7-0.fc44.tar.xz
time-created2026-06-01 15:10:46
time-finished2026-06-01 15:13:23
titleFixed findings
toolcsmock
tool-args'/usr/bin/csmock' '-r' 'fedora-rawhide-x86_64' '-t' 'shellcheck,cppcheck,clippy,unicontrol,gcc' '-o' '/tmp/tmpgocehwmg/nfs-utils-2.8.7-0.fc44.tar.xz' '--gcc-analyze' '--unicontrol-notests' '--unicontrol-bidi-only' '--install' 'pam' '--gcc-analyzer-bin=/usr/bin/gcc' '/tmp/tmpgocehwmg/nfs-utils-2.8.7-0.fc44.src.rpm'
tool-versioncsmock-3.8.5.20260529.133039.g6f3b5c6-1.el9