libpq stricter integer parsing
Fabien COELHO <coelho@cri.ensmp.fr>
From: Fabien COELHO <coelho@cri.ensmp.fr>
To: PostgreSQL Developers <pgsql-hackers@lists.postgresql.org>
Date: 2018-08-17T10:13:12Z
Lists: pgsql-hackers
Attachments
- libpq-strict-atoi-1.patch (text/x-diff) patch
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.
Commits
-
Parse more strictly integer parameters from connection strings in libpq
- e7a2217978d9 12.0 landed