From 2e80cf9bbae086c0ab504e51a9f6ec3ac34435b2 Mon Sep 17 00:00:00 2001 From: Dave Murphy Date: Sat, 27 May 2023 10:22:19 +0100 Subject: [PATCH] quote timezone to allow +/- & alphanumerics --- nx/source/runtime/newlib.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/nx/source/runtime/newlib.c b/nx/source/runtime/newlib.c index b3a2de087..c348ef583 100644 --- a/nx/source/runtime/newlib.c +++ b/nx/source/runtime/newlib.c @@ -320,10 +320,13 @@ void __libnx_init_time(void) hour = tmp_offset % 24; memset(envstr, 0, sizeof(envstr)); - + strptr = envstr; + // Some tznames have numeric characters and '-'/'+', so quote tzname with <>. + *strptr++ = '<'; //Avoid using *printf. - strncpy(envstr, /*info.timezoneName*/"NX", sizeof(envstr)-1); // Some tznames have numeric characters and '-'/'+', so the actual tzname can't be used. + strncpy(strptr, info.timezoneName, sizeof(envstr)-1); strptr = &envstr[strlen(envstr)]; + *strptr++ = '>'; *strptr++ = is_west ? '+' : '-'; *strptr++ = '0' + (hour / 10);