From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from deimos.uberspace.de (deimos.uberspace.de [185.26.156.152]) by sourceware.org (Postfix) with ESMTPS id 88ACB3857404 for ; Mon, 21 Mar 2022 16:07:41 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 88ACB3857404 Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=jdoubleu.de Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=jdoubleu.de Received: (qmail 31401 invoked by uid 989); 21 Mar 2022 16:07:40 -0000 Authentication-Results: deimos.uberspace.de; auth=pass (plain) Message-ID: <82f48cb4-c456-b745-6c07-0955316755fc@jdoubleu.de> Date: Mon, 21 Mar 2022 17:07:38 +0100 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:91.0) Gecko/20100101 Thunderbird/91.7.0 Subject: Re: [PATCH 2/2] newlib/libc/time/tzset_r.c(_tzset_unlocked_r): POSIX angle bracket <> support Content-Language: de-DE To: newlib@sourceware.org References: <20220225163959.48753-1-Brian.Inglis@SystematicSW.ab.ca> <20220225163959.48753-3-Brian.Inglis@SystematicSW.ab.ca> From: jdoubleu In-Reply-To: <20220225163959.48753-3-Brian.Inglis@SystematicSW.ab.ca> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit X-Rspamd-Bar: / X-Rspamd-Report: BAYES_HAM(-0.113246) MIME_GOOD(-0.1) X-Rspamd-Score: -0.213246 Received: from unknown (HELO unkown) (::1) by deimos.uberspace.de (Haraka/2.8.28) with ESMTPSA; Mon, 21 Mar 2022 17:07:40 +0100 X-Spam-Status: No, score=-1.6 required=5.0 tests=BAYES_00, BODY_8BITS, KAM_DMARC_STATUS, MSGID_FROM_MTA_HEADER, NICE_REPLY_A, RCVD_IN_DNSWL_NONE, SPF_HELO_NONE, SPF_PASS, TXREP, T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.4 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on server2.sourceware.org X-BeenThere: newlib@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Newlib mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 21 Mar 2022 16:07:43 -0000 Hi, On 2/25/2022 5:39 PM, Brian Inglis wrote: > > define POSIX specified minimum TZ abbr size 3 TZNAME_MIN > use limits.h TZNAME_MAX, _POSIX_TZNAME_MAX, unistd.h sysconf(_SC_TZNAME_MAX) > issue error if no symbols defined (document fallback value in case required) > allow POSIX angle bracket < > quoted signed alphanumeric tz abbr e.g. > allow POSIX unquoted alphabetic tz abbr e.g. MESZ > apply same changes for DST tz abbr > --- > newlib/libc/time/tzset_r.c | 74 ++++++++++++++++++++++++++++++++------ > 1 file changed, 64 insertions(+), 10 deletions(-) > > + /* quit if no items, too few or too many chars, or no close quote '>' */ > + if (sscanf (tzenv, "%10[-+0-9A-Za-z]%n", __tzname_std, &n) <= 0 > + || n < TZNAME_MIN || TZNAME_MAX < n || '>' != tzenv[n]) > + return; Is it safe to use the minus (-) as first char in the sscanf format set: "%10[-+0-9A-Za-z]%n"? Newlib's sscanf docs states (https://sourceware.org/newlib/libc.html#sscanf): > There is also a range facility which you can use as a shortcut. %[0-9] matches all decimal digits. The hyphen must not be the first or last character in the set. Cheers --- 🙎🏻‍♂️ jdoubleu