quote timezone to allow +/- & alphanumerics

This commit is contained in:
Dave Murphy 2023-05-27 10:22:19 +01:00
parent 6602c440b4
commit e6b0955487
No known key found for this signature in database
GPG Key ID: F7FD5492264BB9D0

View File

@ -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);