Re: Incorrect usage of strtol, atoi for non-numeric junk inputs

From: Michael Paquier <michael(at)paquier(dot)xyz>
To: David Rowley <dgrowleyml(at)gmail(dot)com>
Cc: Kyotaro Horiguchi <horikyota(dot)ntt(at)gmail(dot)com>, Alvaro Herrera <alvherre(at)alvh(dot)no-ip(dot)org>, Bharath Rupireddy <bharath(dot)rupireddyforpostgres(at)gmail(dot)com>, PostgreSQL Developers <pgsql-hackers(at)lists(dot)postgresql(dot)org>
Subject: Re: Incorrect usage of strtol, atoi for non-numeric junk inputs
Date: 2021-07-26 06:01:35
Message-ID: YP5Pv0d13Ct+03ve@paquier.xyz
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Sat, Jul 24, 2021 at 07:41:12PM +0900, Michael Paquier wrote:
> I have looked at that over the last couple of days, and applied it
> after some small fixes, including an indentation.

One thing that we forgot here is the handling of trailing
whitespaces. Attached is small patch to adjust that, with one
positive and one negative tests.

> The int64 and float
> parts are extra types we could handle, but I have not looked yet at
> how much benefits we'd get in those cases.

I have looked at these two but there is really less benefits, so for
now I am not planning to do more in this area. For float options,
pg_basebackup --max-rate could be one target on top of the three set
of options in pgbench, but it needs to handle units :(
--
Michael

Attachment Content-Type Size
0001-Skip-trailing-whitespaces-when-parsing-integer-optio.patch text/x-diff 2.5 KB

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Michael Paquier 2021-07-26 07:01:08 Some code cleanup for pgbench and pg_verifybackup
Previous Message tanghy.fnst@fujitsu.com 2021-07-26 05:50:28 RE: [Doc] Tiny fix for regression tests example