Compare commits
10 Commits
4f9afbe1ff
...
2301fa5901
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
2301fa5901 | ||
|
|
9f7998d133 | ||
|
|
f656cd28c6 | ||
|
|
4901b9d909 | ||
|
|
15dea9ff0d | ||
|
|
7858af4ae3 | ||
|
|
85468c72bc | ||
|
|
a35095afba | ||
|
|
04cb2faeaf | ||
|
|
de7e82fbd5 |
71
backport-CVE-2023-24056.patch
Normal file
71
backport-CVE-2023-24056.patch
Normal file
@ -0,0 +1,71 @@
|
||||
From 628b2b2bafa5d3a2017193ddf375093e70666059 Mon Sep 17 00:00:00 2001
|
||||
From: Ariadne Conill <ariadne@dereferenced.org>
|
||||
Date: Fri, 20 Jan 2023 22:07:03 +0000
|
||||
Subject: [PATCH] tuple: test for, and stop string processing, on truncation
|
||||
|
||||
otherwise a buffer overflow occurs.
|
||||
this has been a bug in pkgconf since the beginning, it seems.
|
||||
instead of disclosing the bug correctly, a "hotshot" developer
|
||||
decided to blog about it instead. sigh.
|
||||
|
||||
https://nullprogram.com/blog/2023/01/18/
|
||||
---
|
||||
libpkgconf/tuple.c | 28 +++++++++++++++++++++++-----
|
||||
1 file changed, 23 insertions(+), 5 deletions(-)
|
||||
|
||||
diff --git a/libpkgconf/tuple.c b/libpkgconf/tuple.c
|
||||
index 0d9946d..f14d28f 100644
|
||||
--- a/libpkgconf/tuple.c
|
||||
+++ b/libpkgconf/tuple.c
|
||||
@@ -290,12 +290,21 @@ pkgconf_tuple_parse(const pkgconf_client_t *client, pkgconf_list_t *vars, const
|
||||
}
|
||||
}
|
||||
|
||||
+ size_t remain = PKGCONF_BUFSIZE - (bptr - buf);
|
||||
ptr += (pptr - ptr);
|
||||
kv = pkgconf_tuple_find_global(client, varname);
|
||||
if (kv != NULL)
|
||||
{
|
||||
- strncpy(bptr, kv, PKGCONF_BUFSIZE - (bptr - buf));
|
||||
- bptr += strlen(kv);
|
||||
+ size_t nlen = pkgconf_strlcpy(bptr, kv, remain);
|
||||
+ if (nlen > remain)
|
||||
+ {
|
||||
+ pkgconf_warn(client, "warning: truncating very long variable to 64KB\n");
|
||||
+
|
||||
+ bptr = buf + (PKGCONF_BUFSIZE - 1);
|
||||
+ break;
|
||||
+ }
|
||||
+
|
||||
+ bptr += nlen;
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -303,12 +312,21 @@ pkgconf_tuple_parse(const pkgconf_client_t *client, pkgconf_list_t *vars, const
|
||||
|
||||
if (kv != NULL)
|
||||
{
|
||||
+ size_t nlen;
|
||||
+
|
||||
parsekv = pkgconf_tuple_parse(client, vars, kv);
|
||||
+ nlen = pkgconf_strlcpy(bptr, parsekv, remain);
|
||||
+ free(parsekv);
|
||||
|
||||
- strncpy(bptr, parsekv, PKGCONF_BUFSIZE - (bptr - buf));
|
||||
- bptr += strlen(parsekv);
|
||||
+ if (nlen > remain)
|
||||
+ {
|
||||
+ pkgconf_warn(client, "warning: truncating very long variable to 64KB\n");
|
||||
|
||||
- free(parsekv);
|
||||
+ bptr = buf + (PKGCONF_BUFSIZE - 1);
|
||||
+ break;
|
||||
+ }
|
||||
+
|
||||
+ bptr += nlen;
|
||||
}
|
||||
}
|
||||
}
|
||||
--
|
||||
2.33.0
|
||||
|
||||
Binary file not shown.
BIN
pkgconf-1.7.3.tar.xz
Normal file
BIN
pkgconf-1.7.3.tar.xz
Normal file
Binary file not shown.
42
pkgconf.spec
42
pkgconf.spec
@ -1,15 +1,15 @@
|
||||
%global pkgconf_libdirs %{_libdir}/pkgconfig:%{_datadir}/pkgconfig
|
||||
|
||||
Name: pkgconf
|
||||
Version: 1.6.3
|
||||
Release: 5
|
||||
Version: 1.7.3
|
||||
Release: 2
|
||||
Summary: Package compiler and linker metadata toolkit
|
||||
|
||||
License: ISC
|
||||
URL: http://pkgconf.org/
|
||||
Source0: https://distfiles.dereferenced.org/%{name}/%{name}-%{version}.tar.xz
|
||||
|
||||
Source1: platform-pkg-config.in
|
||||
Patch6000: backport-CVE-2023-24056.patch
|
||||
|
||||
BuildRequires: gcc, make, autoconf, automake, libtool
|
||||
#tests
|
||||
@ -65,13 +65,18 @@ make check
|
||||
|
||||
%delete_la_and_a
|
||||
|
||||
install -pm 0755 %{SOURCE1} %{buildroot}%{_bindir}/%{_target_platform}-pkg-config
|
||||
cat <<EOF > %{buildroot}%{_bindir}/%{_target_platform}-pkg-config
|
||||
#!/bin/sh
|
||||
|
||||
sed -e "s|@TARGET_PLATFORM@|%{_target_platform}|" \
|
||||
-e "s|@PKGCONF_LIBDIRS@|%{pkgconf_libdirs}|" \
|
||||
-e "s|@PKGCONF_SYSLIBDIR@|%{_libdir}|" \
|
||||
-e "s|@PKGCONF_SYSINCDIR@|%{_includedir}|" \
|
||||
-i %{buildroot}%{_bindir}/%{_target_platform}-pkg-config
|
||||
# Platform-specific version of pkg-config
|
||||
# Platform----%{_target_platform}
|
||||
|
||||
export PKG_CONFIG_LIBDIR="\${PKG_CONFIG_LIBDIR:-%{pkgconf_libdirs}}"
|
||||
export PKG_CONFIG_SYSTEM_INCLUDE_PATH="\${PKG_CONFIG_SYSTEM_INCLUDE_PATH:-%{_includedir}}"
|
||||
export PKG_CONFIG_SYSTEM_LIBRARY_PATH="\${PKG_CONFIG_SYSTEM_LIBRARY_PATH:-%{_libdir}}"
|
||||
|
||||
exec pkgconf "\$@"
|
||||
EOF
|
||||
|
||||
ln -sf pkgconf %{buildroot}%{_bindir}/pkg-config
|
||||
|
||||
@ -88,7 +93,7 @@ mkdir -p %{buildroot}%{_datadir}/pkgconfig
|
||||
%{_libdir}/lib%{name}*.so.*
|
||||
%{_datadir}/aclocal/pkg.m4
|
||||
%{_bindir}/pkg-config
|
||||
%{_bindir}/%{_target_platform}-pkg-config
|
||||
%attr(755,root,root) %{_bindir}/%{_target_platform}-pkg-config
|
||||
%dir %{_libdir}/pkgconfig
|
||||
%dir %{_datadir}/pkgconfig
|
||||
|
||||
@ -101,6 +106,21 @@ mkdir -p %{buildroot}%{_datadir}/pkgconfig
|
||||
%{_mandir}/*/*
|
||||
|
||||
%changelog
|
||||
* Sun Jan 29 2023 dongyuzhen <dongyuzhen@h-partners.com> - 1.7.3-2
|
||||
- fix CVE-2023-24056
|
||||
|
||||
* Thu Jul 16 2020 shixuantong <shixuantong@huawei.com> - 1.7.3-1
|
||||
- Type: NA
|
||||
- ID: NA
|
||||
- SUG: NA
|
||||
- DESC:update to 1.7.3-1
|
||||
|
||||
* Sun Jan 12 2020 openEuler Buildteam <buildteam@openeuler.org> - 1.6.3-6
|
||||
- Type: enhancement
|
||||
- ID: NA
|
||||
- SUG: NA
|
||||
- DESC: strengthen spec
|
||||
|
||||
* Thu Nov 28 2019 shenyangyang <shenyangyang4@huawei.com> - 1.6.3-5
|
||||
- Type: enhancement
|
||||
- ID: NA
|
||||
@ -113,7 +133,7 @@ mkdir -p %{buildroot}%{_datadir}/pkgconfig
|
||||
- SUG: NA
|
||||
- DESC:add provides of libpkgconf
|
||||
|
||||
* Sat Oct 14 2019 shenyangyang <shenyangyang4@huawei.com> - 1.6.3-3
|
||||
* Mon Oct 14 2019 shenyangyang <shenyangyang4@huawei.com> - 1.6.3-3
|
||||
- Type: enhancement
|
||||
- ID: NA
|
||||
- SUG: NA
|
||||
|
||||
@ -1,10 +0,0 @@
|
||||
#!/bin/sh
|
||||
|
||||
# Simple wrapper to tell pkgconf to behave as a platform-specific version of pkg-config
|
||||
# Platform: @TARGET_PLATFORM@
|
||||
|
||||
export PKG_CONFIG_LIBDIR="${PKG_CONFIG_LIBDIR:-@PKGCONF_LIBDIRS@}"
|
||||
export PKG_CONFIG_SYSTEM_LIBRARY_PATH="${PKG_CONFIG_SYSTEM_LIBRARY_PATH:-@PKGCONF_SYSLIBDIR@}"
|
||||
export PKG_CONFIG_SYSTEM_INCLUDE_PATH="${PKG_CONFIG_SYSTEM_INCLUDE_PATH:-@PKGCONF_SYSINCDIR@}"
|
||||
|
||||
exec pkgconf "$@"
|
||||
Loading…
x
Reference in New Issue
Block a user