From ebac9aee23f28aaddf17507712696f56727513d4 Mon Sep 17 00:00:00 2001 From: Pat Hickey Date: Mon, 17 Jun 2024 09:48:52 -0700 Subject: [PATCH] timezone __secs_to_zone stub: guard against null pointer dereference (#507) Closes #506 --- libc-top-half/musl/src/time/__tz.c | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/libc-top-half/musl/src/time/__tz.c b/libc-top-half/musl/src/time/__tz.c index 955150344..7efb9a975 100644 --- a/libc-top-half/musl/src/time/__tz.c +++ b/libc-top-half/musl/src/time/__tz.c @@ -434,10 +434,14 @@ weak_alias(__tzset, tzset); void __secs_to_zone(long long t, int local, int *isdst, int *offset, long *oppoff, const char **zonename) { // Minimalist implementation for now. - *isdst = 0; - *offset = 0; - *oppoff = 0; - *zonename = __utc; + if (isdst) + *isdst = 0; + if (offset) + *offset = 0; + if (oppoff) + *oppoff = 0; + if (zonename) + *zonename = __utc; } #endif