Update musl C library to 1.2.6. Fixes CVE-2025-26519 * Patches refreshed. Unnecessary upstream patch removed. * Add a post-release patch for timezone handling in datetime string matching (affecting at least uhttpd): bug report: https://www.openwall.com/lists/musl/2026/03/22/3 fix: https://www.openwall.com/lists/musl/2026/03/30/6 1.2.6 release notes https://git.musl-libc.org/cgit/musl/tree/WHATSNEW?id=9fa28ece75d8a2191de7c5bb53bed224c5947417 new features: - posix_getdents interface (new in POSIX-2024) - renameat2 interface (linux extension) - iconv support for CP858 - vdso clock_gettime for riscv{32,64}, powerpc{,64}, and s390x - loongarch64 TLSDESC support - exposed __getauxval for compiler runtime use detecting cpu features compatibility: - initgroups no longer artificially limits number of supplementary groups - getusershell now skips blank lines and comments - exit is now explicitly thread-safe (possible future requirement) - atexit now fails rather than deadlocking if called from late dtor - strerror now has error strings for EUCLEAN and ENAVAIL - isatty no longer collapses errors to ENOTTY - sched.h namespace pollution with _GNU_SOURCE is reduced - hasmntopt now matches only whole options, not arbitrary substrings - shadow.h no longer declares an unimplemented sgetspent interface - vdso with missing sysv hash table (only gnu hash) is now supported conformance: - pwrite now handles O_APPEND correctly, reports error if it can't - mbnrtowcs now conforms to new POSIX-2024 requirement for partial character - iconv GBK now properly includes euro symbol - strptime now accepts conversion specifiers added in POSIX-2024 - inet_ntop IPv6 "zero compression" now conforms to RFC 5952 bugs fixed: - iconv euc-kr decoder could do oob writes on invalid inputs (CVE-2025-26519) - iconv shift_jis decoder could produce wrong outputs for some invalid inputs - printf did not honor hex float precision correctly in some cases - lost or delayed wakes in sem_post under race condition - termios input speed handling was wrong - strcasestr failed to match zero-length needle - fma handled corner case with negative zero wrongly - syslog LOG_MAKEPRI macro was incorrect - timer_create is no longer affected by known pthread_barrier bugs - sysconf(_SC_MINSIGSTKSZ) computed min size incorrectly - statx emulation left some fields uninitialized - mntent wrongly included final newline in parsed field output - SIGEV_THREAD timers could abort process if SIGTIMER became unblocked - bind_textdomain_codeset returned wrong value arch-specific bugs fixed: - early dynamic linker handled page size wrong on dynamic pagesize archs - arm and aarch64 crti/n files had wrong alignment - m68k POLLWRNORM and POLLWRBAND values were incorrect - x32 mq ABI was mismatched Signed-off-by: Hannu Nyman <hannu.nyman@iki.fi> Link: https://github.com/openwrt/openwrt/pull/22547 Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>
100 lines
3.2 KiB
Diff
100 lines
3.2 KiB
Diff
From 0572555dab1d1e10b5f7351a005ec588cab41e25 Mon Sep 17 00:00:00 2001
|
|
From: Rich Felker <dalias@aerifal.cx>
|
|
Date: Sun, 22 Mar 2026 21:32:35 -0400
|
|
Subject: [PATCH] fix incorrect access to tzname[] by strptime %Z conversion
|
|
specifier
|
|
|
|
there are three issues here:
|
|
|
|
1. if tzset has not been called (explicitly or implicitly), the
|
|
tzname[] array will contain null pointers, and the dereference to
|
|
compare against them has undefined behavior (and will fault).
|
|
|
|
2. access to tzname[] was performed without the timezone lock held.
|
|
this resulted in a data race if the timezone is concurrently changed
|
|
from another thread.
|
|
|
|
3. due to unintended signedness of the types, the open-coded isalpha
|
|
in the non-matching case was wrong and would continue past null
|
|
termination.
|
|
|
|
to fix the first two issues, the body of the %Z conversion is moved to
|
|
__tz.c where it has access to locking, and null checks are added.
|
|
|
|
there is probably an argument to be made that the equivalent of tzset
|
|
should happen here, but POSIX does not specify that to happen, so in
|
|
the absence of an interpretation adding such an allowance or
|
|
requirement, it is not done.
|
|
|
|
the third issue is fixed just by using the existing isalpha macro.
|
|
---
|
|
src/time/__tz.c | 19 +++++++++++++++++++
|
|
src/time/strptime.c | 13 +++----------
|
|
src/time/time_impl.h | 1 +
|
|
3 files changed, 23 insertions(+), 10 deletions(-)
|
|
|
|
--- a/src/time/__tz.c
|
|
+++ b/src/time/__tz.c
|
|
@@ -436,3 +436,22 @@ const char *__tm_to_tzname(const struct
|
|
UNLOCK(lock);
|
|
return p;
|
|
}
|
|
+
|
|
+int __tzname_to_isdst(const char *restrict *s)
|
|
+{
|
|
+ size_t len;
|
|
+ int isdst = -1;
|
|
+ LOCK(lock);
|
|
+ if (tzname[0] && !strncmp(*s, tzname[0], len = strlen(tzname[0]))) {
|
|
+ isdst = 0;
|
|
+ *s += len;
|
|
+ } else if (tzname[1] && !strncmp(*s, tzname[1], len=strlen(tzname[1]))) {
|
|
+ isdst = 1;
|
|
+ *s += len;
|
|
+ } else {
|
|
+ /* FIXME: is this supposed to be an error? */
|
|
+ while (isalpha(**s)) ++*s;
|
|
+ }
|
|
+ UNLOCK(lock);
|
|
+ return isdst;
|
|
+}
|
|
--- a/src/time/strptime.c
|
|
+++ b/src/time/strptime.c
|
|
@@ -5,6 +5,7 @@
|
|
#include <stddef.h>
|
|
#include <string.h>
|
|
#include <strings.h>
|
|
+#include "time_impl.h"
|
|
|
|
char *strptime(const char *restrict s, const char *restrict f, struct tm *restrict tm)
|
|
{
|
|
@@ -207,16 +208,8 @@ char *strptime(const char *restrict s, c
|
|
s += 5;
|
|
break;
|
|
case 'Z':
|
|
- if (!strncmp(s, tzname[0], len = strlen(tzname[0]))) {
|
|
- tm->tm_isdst = 0;
|
|
- s += len;
|
|
- } else if (!strncmp(s, tzname[1], len=strlen(tzname[1]))) {
|
|
- tm->tm_isdst = 1;
|
|
- s += len;
|
|
- } else {
|
|
- /* FIXME: is this supposed to be an error? */
|
|
- while ((*s|32)-'a' <= 'z'-'a') s++;
|
|
- }
|
|
+ i = __tzname_to_isdst(&s);
|
|
+ if (i>=0) tm->tm_isdst = i;
|
|
break;
|
|
case '%':
|
|
if (*s++ != '%') return 0;
|
|
--- a/src/time/time_impl.h
|
|
+++ b/src/time/time_impl.h
|
|
@@ -5,6 +5,7 @@ hidden int __month_to_secs(int, int);
|
|
hidden long long __year_to_secs(long long, int *);
|
|
hidden long long __tm_to_secs(const struct tm *);
|
|
hidden const char *__tm_to_tzname(const struct tm *);
|
|
+hidden int __tzname_to_isdst(const char *restrict *);
|
|
hidden int __secs_to_tm(long long, struct tm *);
|
|
hidden void __secs_to_zone(long long, int, int *, long *, long *, const char **);
|
|
hidden const char *__strftime_fmt_1(char (*)[100], size_t *, int, const struct tm *, locale_t, int);
|