public inbox for git-commits@fedoraproject.org
help / color / mirror / Atom feed
From: Steve Grubb <sgrubb@redhat.com>
To: git-commits@fedoraproject.org
Subject: [rpms/libcap-ng] f43: New upstream feature release
Date: Fri, 21 Aug 2026 03:41:20 GMT	[thread overview]
Message-ID: <178728368040.1.14781441375121206878.rpms-libcap-ng-849aa307fa1e@fedoraproject.org> (raw)

A new commit has been pushed.

Repo   : rpms/libcap-ng
Branch : f43
Commit : 849aa307fa1e92b74ba7d2300a3d3627495a5583
Author : Steve Grubb <sgrubb@redhat.com>
Date   : 2026-08-20T17:24:34-04:00
Stats  : +76/-2 in 2 file(s)
URL    : https://src.fedoraproject.org/rpms/libcap-ng/c/849aa307fa1e92b74ba7d2300a3d3627495a5583?branch=f43

Log:
New upstream feature release

---
diff --git a/fix-u32-parsing.patch b/fix-u32-parsing.patch
new file mode 100644
index 0000000..ff5b709
--- /dev/null
+++ b/fix-u32-parsing.patch
@@ -0,0 +1,70 @@
+commit 1b7d3fd270a597d37486a01fbc7637b5e4cf9709
+Author: Steve Grubb <ausearch.1@gmail.com>
+Date:   Thu Aug 20 17:04:46 2026 -0400
+
+    Fix netcap u32 parsing on 32-bit systems
+    
+    parse_u32_hex_or_dec relied on comparing strtoul's result with UINT_MAX. On 32-bit systems, an out-of-range value saturates at ULONG_MAX, which is also UINT_MAX, so overflow and negative input could be accepted and the i686 utility_logic_test failed.
+    
+    Clear errno before conversion, reject ERANGE and signed input, and retain the explicit UINT_MAX comparison for platforms with wider unsigned long values.
+    
+    Extend utility_logic_test with the maximum valid u32, the next overflowing value, and signed input. The full native test suite passes.
+
+diff --git a/utils/netcap.c b/utils/netcap.c
+index c763281..09068c8 100644
+--- a/utils/netcap.c
++++ b/utils/netcap.c
+@@ -462,6 +462,9 @@ NETCAP_TESTABLE int parse_u32_hex_or_dec(const char *s, unsigned int *out)
+ 	int base = 10;
+ 	const char *p;
+ 
++	/* strtoul accepts signs, but these kernel fields are unsigned. */
++	if (*s == '+' || *s == '-')
++		return -1;
+ 	for (p = s; *p; p++) {
+ 		if ((*p >= 'a' && *p <= 'f') || (*p >= 'A' && *p <= 'F')) {
+ 			base = 16;
+@@ -472,12 +475,13 @@ NETCAP_TESTABLE int parse_u32_hex_or_dec(const char *s, unsigned int *out)
+ 		base = 16;
+ 	if (base == 10 && strlen(s) > 3 && s[0] == '0')
+ 		base = 16;
++	errno = 0;
+ 	v = strtoul(s, &end, base);
+-	if (end == s || *end)
++	if (errno == ERANGE || end == s || *end)
+ 		return -1;
+ 	/*
+-	 * /proc and diag inputs are meant to fit in u32 fields. Reject values
+-	 * above that range instead of silently truncating them into new ids.
++	 * /proc and diag inputs are meant to fit in u32 fields. On platforms
++	 * where unsigned long is wider, reject values that would be truncated.
+ 	 */
+ 	if (v > UINT_MAX)
+ 		return -1;
+diff --git a/utils/test/utility_logic_test.c b/utils/test/utility_logic_test.c
+index 0769712..516d4fb 100644
+--- a/utils/test/utility_logic_test.c
++++ b/utils/test/utility_logic_test.c
+@@ -9,6 +9,7 @@
+  */
+ 
+ #include "config.h"
++#include <limits.h>
+ #include <stdio.h>
+ #include <stdlib.h>
+ #include <string.h>
+@@ -48,8 +49,14 @@ static void test_parse_u32_hex_or_dec(void)
+ 		fail("hex parse with leading zero failed");
+ 	if (parse_u32_hex_or_dec("G1", &out) == 0)
+ 		fail("invalid parse should fail");
++	if (parse_u32_hex_or_dec("4294967295", &out) != 0 || out != UINT_MAX)
++		fail("maximum u32 parse failed");
+ 	if (parse_u32_hex_or_dec("4294967296", &out) == 0)
+ 		fail("overflow parse should fail");
++	if (parse_u32_hex_or_dec("+1", &out) == 0)
++		fail("positive sign parse should fail");
++	if (parse_u32_hex_or_dec("-1", &out) == 0)
++		fail("negative parse should fail");
+ }
+ 
+ static void test_list_inode_iteration(void)

diff --git a/libcap-ng.spec b/libcap-ng.spec
index cac81fe..944e50c 100644
--- a/libcap-ng.spec
+++ b/libcap-ng.spec
@@ -2,11 +2,11 @@
 Summary: Alternate posix capabilities library
 Name: libcap-ng
 Version: 0.9.4
-Release: 1%{?dist}
+Release: 2%{?dist}
 License: LGPL-2.0-or-later
 URL: https://github.com/stevegrubb/libcap-ng
 Source0: %{name}-%{version}.tar.gz
-
+Patch1: fix-u32-parsing.patch
 BuildRequires: gcc make
 BuildRequires: autoconf automake libtool
 BuildRequires: kernel-headers >= 2.6.11 
@@ -61,6 +61,7 @@ to determine the necessary capabilities for a program.
 %prep
 %setup -q
 touch -d @${SOURCE_DATE_EPOCH:?} NEWS
+%patch -P 1 -p1
 
 %build
 # Locate suitable vmlinux.h. In normal builds under mock,
@@ -131,6 +132,9 @@ make check
 %endif
 
 %changelog
+* Thu Aug 20 2026 Steve Grubb <sgrubb@redhat.com> 0.9.4-2
+- Add patch to fix 32 bit builds
+
 * Thu Aug 20 2026 Steve Grubb <sgrubb@redhat.com> 0.9.4-1
 - New upstream feature release
 

             reply	other threads:[~2026-08-21  3:41 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-08-21  3:41 Steve Grubb [this message]
  -- strict thread matches above, loose matches on Subject: below --
2026-08-21  3:41 [rpms/libcap-ng] f43: New upstream feature release Steve Grubb
2026-08-21  3:41 Steve Grubb

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=178728368040.1.14781441375121206878.rpms-libcap-ng-849aa307fa1e@fedoraproject.org \
    --to=sgrubb@redhat.com \
    --cc=git-commits@fedoraproject.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox