!37 [sync] PR-36: backport patch
From: @openeuler-sync-bot Reviewed-by: @HuaxinLuGitee Signed-off-by: @HuaxinLuGitee
This commit is contained in:
commit
7b3d169ca8
54
backport-getpcaps-catch-PID-parsing-errors.patch
Normal file
54
backport-getpcaps-catch-PID-parsing-errors.patch
Normal file
@ -0,0 +1,54 @@
|
|||||||
|
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>
|
||||||
|
|
||||||
|
conflict:context adaptation
|
||||||
|
---
|
||||||
|
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 ) {
|
||||||
|
ssize_t length;
|
||||||
|
+ 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.32
|
Version: 2.32
|
||||||
Release: 4
|
Release: 5
|
||||||
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
|
||||||
@ -12,6 +12,7 @@ Patch2: backport-capsh-better-error-handling-for-integer-parsing.patch
|
|||||||
Patch3: backport-setcap-clean-up-error-handling-of-the-ns-rootid-argument.patch
|
Patch3: backport-setcap-clean-up-error-handling-of-the-ns-rootid-argument.patch
|
||||||
Patch4: backport-If-needed-search-PATH-for-capsh-self-execution.patch
|
Patch4: backport-If-needed-search-PATH-for-capsh-self-execution.patch
|
||||||
Patch5: backport-Guarantee-sufficient-memory-for-scratch-pathname.patch
|
Patch5: backport-Guarantee-sufficient-memory-for-scratch-pathname.patch
|
||||||
|
Patch6: backport-getpcaps-catch-PID-parsing-errors.patch
|
||||||
|
|
||||||
BuildRequires: libattr-devel pam-devel perl-interpreter gcc
|
BuildRequires: libattr-devel pam-devel perl-interpreter gcc
|
||||||
|
|
||||||
@ -72,6 +73,10 @@ chmod +x %{buildroot}/%{_libdir}/*.so.*
|
|||||||
%{_mandir}/man8/*.gz
|
%{_mandir}/man8/*.gz
|
||||||
|
|
||||||
%changelog
|
%changelog
|
||||||
|
* Thu Feb 16 2023 zhangguangzhi <zhangguangzhi3@huawei.com> - 2.32-5
|
||||||
|
- backport patch
|
||||||
|
backport getpcaps catch PID parsing errors
|
||||||
|
|
||||||
* Sat Jan 22 2022 yixiangzhike <yixiangzhike007@163.com> - 2.32-4
|
* Sat Jan 22 2022 yixiangzhike <yixiangzhike007@163.com> - 2.32-4
|
||||||
- Type:bugfix
|
- Type:bugfix
|
||||||
- ID:NA
|
- ID:NA
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user