glibc/get-nprocs-cpu-online-parsing.patch
Andreas Schwab 71ba03d4de Accepting request 856525 from home:Andreas_Schwab:Factory
- aarch64-static-pie.patch: fix static PIE start code for BTI
  (bsc#1179450, BZ #27068)
- iconv-redundant-shift.patch: iconv: Accept redundant shift sequences in
  IBM1364 (CVE-2020-27618, bsc#1178386, BZ #26224)
- iconv-ucs4-loop-bounds.patch: iconv: Fix incorrect UCS4 inner loop
  bounds (CVE-2020-29562, bsc#1179694, BZ #26923)
- printf-long-double-non-normal.patch: x86: Harden printf against
  non-normal long double values (CVE-2020-29573, bsc#1179721, BZ #26649)
- get-nprocs-cpu-online-parsing.patch: Fix parsing of
  /sys/devices/system/cpu/online (bsc#1180038, BZ #25859)

OBS-URL: https://build.opensuse.org/request/show/856525
OBS-URL: https://build.opensuse.org/package/show/Base:System/glibc?expand=0&rev=574
2020-12-16 16:31:56 +00:00

36 lines
1.1 KiB
Diff

From b5eeca8cfd9d0fd92b5633a88901d9ff27f2b496 Mon Sep 17 00:00:00 2001
From: Andreas Schwab <schwab@linux-m68k.org>
Date: Tue, 8 Dec 2020 19:17:41 +0100
Subject: [PATCH] Fix parsing of /sys/devices/system/cpu/online (bug 25859)
The file contains comma-separated ranges, not spaces.
---
sysdeps/unix/sysv/linux/getsysstats.c | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)
Index: glibc-2.32/sysdeps/unix/sysv/linux/getsysstats.c
===================================================================
--- glibc-2.32.orig/sysdeps/unix/sysv/linux/getsysstats.c
+++ glibc-2.32/sysdeps/unix/sysv/linux/getsysstats.c
@@ -143,6 +143,7 @@ __get_nprocs (void)
char *re = buffer_end;
const int flags = O_RDONLY | O_CLOEXEC;
+ /* This file contains comma-separated ranges. */
int fd = __open_nocancel ("/sys/devices/system/cpu/online", flags);
char *l;
int result = 0;
@@ -175,10 +176,10 @@ __get_nprocs (void)
result += m - n + 1;
l = endp;
- while (l < re && isspace (*l))
+ if (l < re && *l == ',')
++l;
}
- while (l < re);
+ while (l < re && *l != '\n');
__close_nocancel_nostatus (fd);