Hi, While working on [1], I found that some parts of the code is using strtol and atoi without checking for non-numeric junk input strings. I found this strange. Most of the time users provide proper numeric strings but there can be some scenarios where these strings are not user-supplied but generated by some other code which may contain non-numeric strings. Shouldn't the code use strtol or atoi appropriately and error out in such cases? One way to fix this once and for all is to have a common API something like int pg_strtol/pg_str_convert_to_int(char *opt_name, char *opt_value) which returns a generic message upon invalid strings ("invalid value \"%s\" is provided for option \"%s\", opt_name, opt_value) and returns integers on successful parsing.
Although this is not a critical issue, I would like to seek thoughts. [1] - https://www.postgresql.org/message-id/CALj2ACVMO6wY5Pc4oe1OCgUOAtdjHuFsBDw8R5uoYR86eWFQDA%40mail.gmail.com [2] strtol: vacuumlo.c --> ./vacuumlo -l '2323adfd' postgres -p '5432ERE' libpq_pipeline.c --> ./libpq_pipeline -r '2232adf' tests atoi: pg_amcheck.c --> ./pg_amcheck -j '1211efe' pg_basebackup --> ./pg_basebackup -Z 'EFEF' -s 'a$##' pg_receivewal.c --> ./pg_receivewal -p '54343GDFD' -s '54343GDFD' pg_recvlogical.c --> ./pg_recvlogical -F '-$#$#' -p '5432$$$' -s '100$$$' pg_checksums.c. --> ./pg_checksums -f '1212abc' pg_ctl.c --> ./pg_ctl -t 'efc' pg_dump.c --> ./pg_dump -j '454adc' -Z '4adc' --extra-float-digits '-14adc' pg_upgrade/option.c pgbench.c reindexdb.c vacuumdb.c pg_regress.c With Regards, Bharath Rupireddy. EnterpriseDB: http://www.enterprisedb.com