libpq stricter integer parsing

From: Fabien COELHO <coelho(at)cri(dot)ensmp(dot)fr>
To: PostgreSQL Developers <pgsql-hackers(at)lists(dot)postgresql(dot)org>
Subject: libpq stricter integer parsing
Date: 2018-08-17 10:13:12
Message-ID: alpine.DEB.2.21.1808171206180.20841@lancre
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers


Follow up on a patch and discussion with Tom, currently integer parsing on
keywords in libpq is quite loose, resulting in trailing garbage being
ignored and allowing to hide bugs, eg:

sh> psql "connect_timeout=2,port=5433"

The timeout is set to 2, and the port directive is silently ignored.
However, URL parsing is stricter, eg on "port".

The attached patch checks integer syntax errors and overflows, and report
errors.

The pros is that it helps detect bugs. The cons is that some people may
not want to know about these if it works in the end.

--
Fabien.

Attachment Content-Type Size
libpq-strict-atoi-1.patch text/x-diff 4.0 KB

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Fabien COELHO 2018-08-17 11:04:56 Re: [HACKERS] WIP Patch: Pgbench Serialization and deadlock errors
Previous Message Marina Polyakova 2018-08-17 09:31:52 Re: [HACKERS] WIP Patch: Pgbench Serialization and deadlock errors