Skip to content

Commit

Permalink
quote timezone to allow +/- & alphanumerics
Browse files Browse the repository at this point in the history
  • Loading branch information
WinterMute authored and fincs committed May 27, 2023
1 parent 95f973f commit 2e80cf9
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions nx/source/runtime/newlib.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down

0 comments on commit 2e80cf9

Please sign in to comment.