[packages/perl-Net-Interface] fix undefined behavior

atler atler at pld-linux.org
Mon Aug 17 22:25:30 CEST 2026


commit 4a03c09f867f42427ed449fd154238bec43468ea
Author: Jan Palus <atler at pld-linux.org>
Date:   Mon Aug 17 22:23:11 2026 +0200

    fix undefined behavior
    
    sequence point is missing between initialization of len and passing len
    derived argument to strlcpy

 perl-Net-Interface.spec |  2 ++
 ub.patch                | 20 ++++++++++++++++++++
 2 files changed, 22 insertions(+)
---
diff --git a/perl-Net-Interface.spec b/perl-Net-Interface.spec
index e0c453c..2466e30 100644
--- a/perl-Net-Interface.spec
+++ b/perl-Net-Interface.spec
@@ -17,6 +17,7 @@ Source0:	http://www.cpan.org/modules/by-module/Net/%{pdir}-%{pnam}-%{version}.ta
 Patch0:		no-dot-in-inc.patch
 Patch1:		%{name}-iface.patch
 Patch2:		types.patch
+Patch3:		ub.patch
 URL:		http://search.cpan.org/dist/Net-Interface/
 BuildRequires:	perl-devel >= 1:5.8.0
 BuildRequires:	perl-perldoc
@@ -41,6 +42,7 @@ operacyjny na to pozwala).
 %patch -P0 -p1
 %patch -P1 -p1
 %patch -P2 -p1
+%patch -P3 -p1
 
 %build
 %{__perl} Makefile.PL \
diff --git a/ub.patch b/ub.patch
new file mode 100644
index 0000000..d4f2f5d
--- /dev/null
+++ b/ub.patch
@@ -0,0 +1,20 @@
+--- Net-Interface-1.016/Interface.xs.orig	2026-08-17 22:03:46.547652298 +0200
++++ Net-Interface-1.016/Interface.xs	2026-08-17 22:18:35.968367176 +0200
+@@ -896,6 +896,7 @@
+ 	SV * sv;
+ 	char * key, * args = "args", * name = "name", * flav = "flav";
+ 	STRLEN len;
++	const char *s;
+     CODE:
+         if (!SvROK (ref) || !SvOBJECT(SvRV(ref)))
+ 	    croak ("Can't call method \"%s\" without a valid object reference", GvNAME (CvGV (cv)));
+@@ -916,7 +917,8 @@
+ 	sv = *hv_fetch(hv,name,niKEYsz,0);
+ 	if (!SvPOK(sv))
+ 	    goto no_data;
+-	strlcpy(ifr.ni_ifr_name,SvPV(sv,len),len +1);
++	s = SvPV(sv,len);
++	strlcpy(ifr.ni_ifr_name,s,len +1);
+ 	sv = *hv_fetch(hv,flav,niKEYsz,0);
+ 	if (!SvIOK(sv))
+ 	    goto no_data;
================================================================

---- gitweb:

http://git.pld-linux.org/gitweb.cgi/packages/perl-Net-Interface.git/commitdiff/4a03c09f867f42427ed449fd154238bec43468ea



More information about the pld-cvs-commit mailing list