pg.ddx.io  pgsql-committers@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Peter Eisentraut <peter@eisentraut.org>
To: pgsql-committers@lists.postgresql.org
Subject: pgsql: Replace some strtok() with strsep()
Date: Mon, 22 Jul 2024 13:52:39 +0000
Message-ID: <E1sVtSx-000iLM-EG@gemulon.postgresql.org> (raw)

Replace some strtok() with strsep()

strtok() considers adjacent delimiters to be one delimiter, which is
arguably the wrong behavior in some cases.  Replace with strsep(),
which has the right behavior: Adjacent delimiters create an empty
token.

Affected by this are parsing of:

- Stored SCRAM secrets
  ("SCRAM-SHA-256$<iterations>:<salt>$<storedkey>:<serverkey>")

- ICU collation attributes
  ("und@colStrength=primary;colCaseLevel=yes") for ICU older than
  version 54

- PG_COLORS environment variable
  ("error=01;31:warning=01;35:note=01;36:locus=01")

- pg_regress command-line options with comma-separated list arguments
  (--dbname, --create-role) (currently only used pg_regress_ecpg)

Reviewed-by: Kyotaro Horiguchi <horikyota.ntt@gmail.com>
Reviewed-by: David Steele <david@pgmasters.net>
Discussion: https://www.postgresql.org/message-id/flat/79692bf9-17d3-41e6-b9c9-fc8c3944222a@eisentraut.org

Branch
------
master

Details
-------
https://git.postgresql.org/pg/commitdiff/5d2e1cc117b38db6bb5dc2e9ae9115304571ac70

Modified Files
--------------
src/backend/libpq/auth-scram.c    | 11 +++++------
src/backend/utils/adt/pg_locale.c |  3 ++-
src/common/logging.c              |  4 +++-
src/test/regress/pg_regress.c     |  5 ++---
4 files changed, 12 insertions(+), 11 deletions(-)



Message-ID: <E1sVtSx-000iLM-EG@gemulon.postgresql.org>
Permalink:  ../E1sVtSx-000iLM-EG@gemulon.postgresql.org/
Also on:    postgresql.org/message-id/E1sVtSx-000iLM-EG@gemulon.postgresql.org

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-committers@postgresql.org
  Cc: peter@eisentraut.org, pgsql-committers@lists.postgresql.org
  Subject: Re: pgsql: Replace some strtok() with strsep()
  In-Reply-To: <E1sVtSx-000iLM-EG@gemulon.postgresql.org>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox