!33 [sync] PR-32: 【openEuler-22.03-LTS】backport upstream patch
From: @openeuler-sync-bot Reviewed-by: @HuaxinLuGitee Signed-off-by: @HuaxinLuGitee
This commit is contained in:
commit
372f159a28
52
backport-getpcaps-catch-PID-parsing-errors.patch
Normal file
52
backport-getpcaps-catch-PID-parsing-errors.patch
Normal file
@ -0,0 +1,52 @@
|
|||||||
|
From fc804acc078ef03e2c5b3a233f118a537f260ccd Mon Sep 17 00:00:00 2001
|
||||||
|
From: Jakub Wilk <jwilk@jwilk.net>
|
||||||
|
Date: Thu, 1 Sep 2022 22:23:19 +0200
|
||||||
|
Subject: [PATCH] getpcaps: catch PID parsing errors.
|
||||||
|
|
||||||
|
Signed-off-by: Jakub Wilk <jwilk@jwilk.net>
|
||||||
|
Signed-off-by: Andrew G. Morgan <morgan@kernel.org>
|
||||||
|
---
|
||||||
|
progs/getpcaps.c | 19 ++++++++++++++++++-
|
||||||
|
1 file changed, 18 insertions(+), 1 deletion(-)
|
||||||
|
|
||||||
|
diff --git a/progs/getpcaps.c b/progs/getpcaps.c
|
||||||
|
index 8fce0a3..1e914b2 100644
|
||||||
|
--- a/progs/getpcaps.c
|
||||||
|
+++ b/progs/getpcaps.c
|
||||||
|
@@ -39,7 +39,9 @@ int main(int argc, char **argv)
|
||||||
|
}
|
||||||
|
|
||||||
|
for ( ++argv; --argc > 0; ++argv ) {
|
||||||
|
+ long lpid;
|
||||||
|
int pid;
|
||||||
|
+ char *endarg;
|
||||||
|
cap_t cap_d;
|
||||||
|
|
||||||
|
if (!strcmp(argv[0], "--help") || !strcmp(argv[0], "--usage") ||
|
||||||
|
@@ -62,7 +64,22 @@ int main(int argc, char **argv)
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
- pid = atoi(argv[0]);
|
||||||
|
+ errno = 0;
|
||||||
|
+ lpid = strtol(argv[0], &endarg, 10);
|
||||||
|
+ if (*endarg != '\0') {
|
||||||
|
+ errno = EINVAL;
|
||||||
|
+ }
|
||||||
|
+ if (errno == 0) {
|
||||||
|
+ if (lpid < 0 || pid != (pid_t) pid)
|
||||||
|
+ errno = EOVERFLOW;
|
||||||
|
+ }
|
||||||
|
+ if (errno != 0) {
|
||||||
|
+ fprintf(stderr, "Cannot parse pid %s (%s)\n",
|
||||||
|
+ argv[0], strerror(errno));
|
||||||
|
+ retval = 1;
|
||||||
|
+ continue;
|
||||||
|
+ }
|
||||||
|
+ pid = lpid;
|
||||||
|
|
||||||
|
cap_d = cap_get_pid(pid);
|
||||||
|
if (cap_d == NULL) {
|
||||||
|
--
|
||||||
|
2.27.0
|
||||||
|
|
||||||
@ -1,6 +1,6 @@
|
|||||||
Name: libcap
|
Name: libcap
|
||||||
Version: 2.61
|
Version: 2.61
|
||||||
Release: 3
|
Release: 4
|
||||||
Summary: A library for getting and setting POSIX.1e draft 15 capabilities
|
Summary: A library for getting and setting POSIX.1e draft 15 capabilities
|
||||||
License: GPLv2
|
License: GPLv2
|
||||||
URL: https://sites.google.com/site/fullycapable
|
URL: https://sites.google.com/site/fullycapable
|
||||||
@ -10,6 +10,7 @@ Patch0: libcap-buildflags.patch
|
|||||||
Patch1: Fix-syntax-error-in-DEBUG-protected-setcap.c-code.patch
|
Patch1: Fix-syntax-error-in-DEBUG-protected-setcap.c-code.patch
|
||||||
Patch2: backport-psx-free-allocated-memory-at-exit.patch
|
Patch2: backport-psx-free-allocated-memory-at-exit.patch
|
||||||
Patch3: backport-Avoid-a-deadlock-in-forked-psx-thread-exit.patch
|
Patch3: backport-Avoid-a-deadlock-in-forked-psx-thread-exit.patch
|
||||||
|
Patch4: backport-getpcaps-catch-PID-parsing-errors.patch
|
||||||
|
|
||||||
BuildRequires: libattr-devel pam-devel perl-interpreter gcc
|
BuildRequires: libattr-devel pam-devel perl-interpreter gcc
|
||||||
|
|
||||||
@ -73,6 +74,9 @@ chmod +x %{buildroot}/%{_libdir}/*.so.*
|
|||||||
%{_mandir}/man8/*.gz
|
%{_mandir}/man8/*.gz
|
||||||
|
|
||||||
%changelog
|
%changelog
|
||||||
|
* Tue Nov 1 2022 yixiangzhike <yixiangzhike007@163.com> - 2.61-4
|
||||||
|
- backport upstream patch
|
||||||
|
|
||||||
* Wed Oct 12 2022 yixiangzhike <yixiangzhike007@163.com> - 2.61-3
|
* Wed Oct 12 2022 yixiangzhike <yixiangzhike007@163.com> - 2.61-3
|
||||||
- backport upstream patches
|
- backport upstream patches
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user