pg.ddx.io  pgsql-committers@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Alvaro Herrera <alvherre@alvh.no-ip.org>
To: pgsql-committers@lists.postgresql.org
Subject: pgsql: libpq_pipeline: Must strdup(optarg) to avoid crash
Date: Thu, 01 Apr 2021 13:29:14 +0000
Message-ID: <E1lRxNq-0001ia-Eg@gemulon.postgresql.org> (raw)

libpq_pipeline: Must strdup(optarg) to avoid crash

I forgot to strdup() when processing argv[].  Apparently many platforms
hide this mistake from users, but in those that don't you may get a
program crash.  Repair.

Per buildfarm member drongo, which is the only one in all the buildfarm
manifesting a problem here.

While at it, move "numrows" processing out of the line of special cases,
and make it getopt's -r instead.  (A similar thing could be done to
'conninfo', but current use of the program doesn't warrant spending time
on that -- nowhere else we use conninfo in so simplistic a manner.)

Discussion: https://postgr.es/m/20210401124850.GA19247@alvherre.pgsql

Branch
------
master

Details
-------
https://git.postgresql.org/pg/commitdiff/dde1a35aee6266dc8105717275335c46cd2b3650

Modified Files
--------------
src/test/modules/libpq_pipeline/libpq_pipeline.c   | 32 +++++++++++-----------
.../modules/libpq_pipeline/t/001_libpq_pipeline.pl |  5 ++--
2 files changed, 18 insertions(+), 19 deletions(-)



Message-ID: <E1lRxNq-0001ia-Eg@gemulon.postgresql.org>
Permalink:  ../E1lRxNq-0001ia-Eg@gemulon.postgresql.org/
Also on:    postgresql.org/message-id/E1lRxNq-0001ia-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 from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-committers@postgresql.org
  Cc: alvherre@alvh.no-ip.org
  Subject: Re: pgsql: libpq_pipeline: Must strdup(optarg) to avoid crash
  In-Reply-To: <E1lRxNq-0001ia-Eg@gemulon.postgresql.org>
  References: <E1lRxNq-0001ia-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