quote timezone to allow +/- & alphanumerics

This commit is contained in:
Dave Murphy 2023-05-27 10:22:19 +01:00 committed by fincs
parent 95f973fe98
commit 2e80cf9bba

View File

@ -320,10 +320,13 @@ void __libnx_init_time(void)
hour = tmp_offset % 24; hour = tmp_offset % 24;
memset(envstr, 0, sizeof(envstr)); memset(envstr, 0, sizeof(envstr));
strptr = envstr;
// Some tznames have numeric characters and '-'/'+', so quote tzname with <>.
*strptr++ = '<';
//Avoid using *printf. //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 = &envstr[strlen(envstr)];
*strptr++ = '>';
*strptr++ = is_west ? '+' : '-'; *strptr++ = is_west ? '+' : '-';
*strptr++ = '0' + (hour / 10); *strptr++ = '0' + (hour / 10);