!704 添加检查sscanf函数的返回值,防止返回值是EOF错误引发问题
From: @markeryang Reviewed-by: @xujing99 Signed-off-by: @xujing99
This commit is contained in:
commit
c5f7b95660
30
backport-fix-cgtop-sscanf-return-code-checks.patch
Normal file
30
backport-fix-cgtop-sscanf-return-code-checks.patch
Normal file
@ -0,0 +1,30 @@
|
||||
From bab356f5a0b8d4a43a71076c2333ff4da7ed737e Mon Sep 17 00:00:00 2001
|
||||
From: Luca Boccassi <bluca@debian.org>
|
||||
Date: Fri, 19 Jan 2024 15:12:49 +0000
|
||||
Subject: [PATCH] cgtop: fix sscanf return code checks
|
||||
|
||||
sscanf can return EOF on error, so check that we get a result instead.
|
||||
|
||||
CodeQL#2386 and CodeQL#2387
|
||||
|
||||
(cherry picked from commit 204d52c4b79eb19d2919cb5214e999c58a6679c6)
|
||||
---
|
||||
src/cgtop/cgtop.c | 4 ++--
|
||||
1 file changed, 2 insertions(+), 2 deletions(-)
|
||||
|
||||
diff --git a/src/cgtop/cgtop.c b/src/cgtop/cgtop.c
|
||||
index e34da7cf728..ca514554408 100644
|
||||
--- a/src/cgtop/cgtop.c
|
||||
+++ b/src/cgtop/cgtop.c
|
||||
@@ -310,9 +310,9 @@ static int process(
|
||||
|
||||
if (all_unified) {
|
||||
while (!isempty(l)) {
|
||||
- if (sscanf(l, "rbytes=%" SCNu64, &k))
|
||||
+ if (sscanf(l, "rbytes=%" SCNu64, &k) == 1)
|
||||
rd += k;
|
||||
- else if (sscanf(l, "wbytes=%" SCNu64, &k))
|
||||
+ else if (sscanf(l, "wbytes=%" SCNu64, &k) == 1)
|
||||
wr += k;
|
||||
|
||||
l += strcspn(l, WHITESPACE);
|
||||
@ -1,40 +0,0 @@
|
||||
From 72e9c079d0fd769d1bdb7d7db9c49454ce4bd255 Mon Sep 17 00:00:00 2001
|
||||
From: licunlong <licunlong1@huawei.com>
|
||||
Date: Wed, 1 Dec 2021 17:27:07 +0800
|
||||
Subject: [PATCH] disable systemd-{timesyncd, networkd, resolved, homed,
|
||||
userdbd, pstore} by default
|
||||
|
||||
---
|
||||
presets/90-systemd.preset | 12 ++++++------
|
||||
1 file changed, 6 insertions(+), 6 deletions(-)
|
||||
|
||||
diff --git a/presets/90-systemd.preset b/presets/90-systemd.preset
|
||||
index d260874..2a7396c 100644
|
||||
--- a/presets/90-systemd.preset
|
||||
+++ b/presets/90-systemd.preset
|
||||
@@ -16,12 +16,6 @@ enable remote-cryptsetup.target
|
||||
enable machines.target
|
||||
|
||||
enable getty@.service
|
||||
-enable systemd-timesyncd.service
|
||||
-enable systemd-networkd.service
|
||||
-enable systemd-resolved.service
|
||||
-enable systemd-homed.service
|
||||
-enable systemd-userdbd.socket
|
||||
-enable systemd-pstore.service
|
||||
|
||||
disable console-getty.service
|
||||
disable debug-shell.service
|
||||
@@ -44,3 +38,9 @@ disable syslog.socket
|
||||
disable systemd-journal-gatewayd.*
|
||||
disable systemd-journal-remote.*
|
||||
disable systemd-journal-upload.*
|
||||
+disable systemd-timesyncd.service
|
||||
+disable systemd-networkd.service
|
||||
+disable systemd-resolved.service
|
||||
+disable systemd-homed.service
|
||||
+disable systemd-userdbd.socket
|
||||
+disable systemd-pstore.service
|
||||
--
|
||||
2.23.0
|
||||
|
||||
@ -21,7 +21,7 @@
|
||||
Name: systemd
|
||||
Url: https://systemd.io/
|
||||
Version: 249
|
||||
Release: 82
|
||||
Release: 83
|
||||
License: MIT and LGPLv2+ and GPLv2+
|
||||
Summary: System and Service Manager
|
||||
|
||||
@ -673,6 +673,7 @@ Patch6624: backport-unit-don-t-gc-unit-in-oom-queue.patch
|
||||
Patch6625: backport-core-do-not-GC-units-jobs-that-are-in-the-D-Bus-queu.patch
|
||||
Patch6626: backport-sd-event-fix-fd-leak-when-fd-is-owned-by-IO-event-so.patch
|
||||
Patch6627: backport-Update-hwdb.patch
|
||||
Patch6628: backport-fix-cgtop-sscanf-return-code-checks.patch
|
||||
|
||||
Patch9001: update-rtc-with-system-clock-when-shutdown.patch
|
||||
Patch9002: udev-add-actions-while-rename-netif-failed.patch
|
||||
@ -2187,6 +2188,9 @@ grep -q -E '^KEYMAP="?fi-latin[19]"?' /etc/vconsole.conf 2>/dev/null &&
|
||||
/usr/bin/systemd-cryptenroll
|
||||
|
||||
%changelog
|
||||
* Thu Aug 22 2024 yanglongkang <yanglongkang@h-partners.com> - 249-83
|
||||
- backport: fix cgtop sscanf return code checks
|
||||
|
||||
* Thu Jul 11 2024 zhangyao <zhangyao108@huawei.com> - 249-82
|
||||
- Add pci vendor model of the MUCSE and WangXin
|
||||
add backport-Update-hwdb.patch
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user