From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-qk1-x729.google.com (mail-qk1-x729.google.com [IPv6:2607:f8b0:4864:20::729]) by sourceware.org (Postfix) with ESMTPS id AA9C33858CD1 for ; Mon, 31 Jul 2023 14:24:54 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org AA9C33858CD1 Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=gmail.com Received: by mail-qk1-x729.google.com with SMTP id af79cd13be357-76ad842d12fso379839385a.3 for ; Mon, 31 Jul 2023 07:24:54 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1690813494; x=1691418294; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to; bh=ocVH+cRcAVhrz4gc/onbZQiZJvbJ1058BWKqkXCbVIg=; b=JvExOrZiYOSiLdNZj0ikXVF11t8bSyPgOhx2HfnMWc7WA6s8yHkjkIsuxdyEHtF8VY n9hd3PCcycYxz/AP0TBRRxWe1TVRkt9QQaPADThPV1actL6ywuj0KWi7/GLYRVZlIB8x 93ryUG+IzwNXY2JIgrFsX9CSsI3iZbH9wrZb9JqIJY/ptgL3iwmaDUUxSBCb24fmc5j1 FeSZJO5DjwVQfDBqQUUdSzbAWk70AsAY/IDFKJee9unqGN72lOGJvPU1y4yYk/1KWT/b qgro+y4ZRueFhhv37rbCLj+IOIG0PbZzpJqds9PEqF6nwtCayURej2n0aTu5jMmSJI/b TXow== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1690813494; x=1691418294; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=ocVH+cRcAVhrz4gc/onbZQiZJvbJ1058BWKqkXCbVIg=; b=iVYbbvpFMyRFqya45VcWGY/U3JX4sFUHKTzOB2aC67j7R4WRwQa6TQdSIW2feMUvuW wFSWXpVCRrq5k5PEunp5zLB9Ok2Ayh9QaJ0PYztzwBUISwkpaoOXFqmH2V7q8pMT7N1e o02WxSV8adTWgOplVnDgh2gR4QmYTFuxKN8fYq7pv76eD4ZluL4MnYfVmdMnZF+dGg5D SUYgWyceINJmnIeg82DRkLwsTgRfHhCwBKYy1jpfNCaBjJxwQhGxmJV8Rtij+WitwF8s mf659n8qYGCcAdgCIFKS5Xmpeezql7P0whKWdv7QqXE/t0J7mjeAIAxWkvt1gVB1Xnax 5FJw== X-Gm-Message-State: ABy/qLZspT3GPTZHH+KjuGnGMW12bpIw5g1stCKHoY50Y19PNzabm/OD qZOZJ036dqHpYn+WHUnMZ1D4I/U/KswtSg== X-Google-Smtp-Source: APBJJlGLnS7AFcoGSiFMsAj8Z7WsFcHY89Dt9gqBM8wdMu3K6Azs7Lawyg8gnQIMxKevBsF2XH2UOQ== X-Received: by 2002:a05:620a:454d:b0:76c:a564:c8c8 with SMTP id u13-20020a05620a454d00b0076ca564c8c8mr6781396qkp.66.1690813493673; Mon, 31 Jul 2023 07:24:53 -0700 (PDT) Received: from slancast.remote.csb ([69.71.12.177]) by smtp.gmail.com with ESMTPSA id oo14-20020a05620a530e00b0075772c756e0sm3307484qkn.101.2023.07.31.07.24.52 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 31 Jul 2023 07:24:53 -0700 (PDT) From: Stanley Lancaster To: libc-alpha@sourceware.org Cc: Stanley Lancaster Subject: [PATCH] %Z [PATCH v6] Date: Mon, 31 Jul 2023 09:24:21 -0500 Message-Id: <20230731142420.23766-1-lancasterharp@gmail.com> X-Mailer: git-send-email 2.39.3 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-11.9 required=5.0 tests=BAYES_00,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM,GIT_PATCH_0,RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS,TXREP,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org List-Id: --- time/strptime_l.c | 19 ++++++++++++++----- time/tst-strptime.c | 2 ++ 2 files changed, 16 insertions(+), 5 deletions(-) diff --git a/time/strptime_l.c b/time/strptime_l.c index 85c3249fcc..1b84065c19 100644 --- a/time/strptime_l.c +++ b/time/strptime_l.c @@ -770,11 +770,20 @@ __strptime_internal (const char *rp, const char *fmt, struct tm *tmp, break; case 'Z': /* Read timezone but perform no conversion. */ - while (ISSPACE (*rp)) - rp++; - while (!ISSPACE (*rp) && *rp != '\0') - rp++; - break; + { + while (ISSPACE (*rp)) + rp++; + /* Read timezone but perform no conversion. */ + /* we recognize the format [-+a-zA-Z0-9]{3,} */ + const char* start_rp = rp; + + while ((*rp >= 'A' && *rp <= 'Z') || + (*rp >= 'a' && *rp <= 'z') || + (*rp >= '0' && *rp <= '9')) + rp++; + if (start_rp+3 < rp) + return NULL; + } case 'z': /* We recognize four formats: 1. Two digits specify hours. diff --git a/time/tst-strptime.c b/time/tst-strptime.c index 3dae9e0594..40145cb109 100644 --- a/time/tst-strptime.c +++ b/time/tst-strptime.c @@ -48,6 +48,8 @@ static const struct 6, 0, 0, 1 }, { "en_US.ISO-8859-1", "2000-01-01 08:12:21 PM", "%Y-%m-%d %I:%M:%S %p", 6, 0, 0, 1 }, + { "en_US.ISO-8859-1", "2000-01-01 08:12:21 AM CST/", "%Y-%m-%d %I:%M:%S %p %Z/", + 6, 0, 0, 1}, { "ja_JP.EUC-JP", "2001 20 \xb7\xee", "%Y %U %a", 1, 140, 4, 21 }, { "ja_JP.EUC-JP", "2001 21 \xb7\xee", "%Y %W %a", 1, 140, 4, 21 }, /* Most of the languages do not need the declension of the month names -- 2.39.3