Re: [PATCH 2/2] tzset_r.c(_tzset_unlocked_r): POSIX angle bracket <> support

jdoubleu <[email protected]>
Newsgroups gmane.comp.lib.newlib
Message-ID <[email protected]>
Hi,

> +      if (sscanf (tzenv, "%10[-+0-9A-Za-z]%n", __tzname_std, &n) <= 0
> +		|| n < TZNAME_MIN || TZNAME_MAX < n || '>' != tzenv[n])

during testing I noticed, that the condition `TZNAME_MAX < n` can never 
be true. The format to sscanf explicitly parses 10 characters at maximum.

Longer input strings will be truncated. That is also the case with the 
glibc implementation.


Cheers
---
🙎🏻‍♂️ jdoubleu
On 4/5/2022 6:03 AM, Brian Inglis wrote:
> 
> local defines for POSIX minimum TZ abbr size 3 TZNAME_MIN and
> maximum TZ abbr size supported 10 TZNAME_MAX
> allow POSIX angle bracket < > quoted signed alphanumeric tz abbr e.g. <MESZ+0330>
> allow POSIX unquoted alphabetic tz abbr e.g. MESZ
> allow same suuport for DST tz abbr
> ---
>   newlib/libc/time/tzset_r.c | 67 +++++++++++++++++++++++++++++++-------
>   1 file changed, 55 insertions(+), 12 deletions(-)
>
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.