Unbounded %s in sscanf

Поиск
Список
Период
Сортировка
От Daniel Gustafsson
Тема Unbounded %s in sscanf
Дата
Msg-id B14D3D7B-F98C-4E20-9459-C122C67647FB@yesql.se
обсуждение исходный текст
Ответы Re: Unbounded %s in sscanf  (Tom Lane <tgl@sss.pgh.pa.us>)
Re: Unbounded %s in sscanf  (Alvaro Herrera <alvherre@alvh.no-ip.org>)
Список pgsql-hackers
I happened to spot the below call in src/bin/pg_basebackup/streamutil.c which
has an unbounded %s in the format.

    /* fetch xlog value and unit from the result */
    if (sscanf(PQgetvalue(res, 0, 0), "%d%s", &xlog_val, xlog_unit) != 2)

There is no risk of overflow as the unit is defined to be at most 2 characters,
but that's not explained (like how a similar %s is handled in pg_dump).  The
attached adds a small explanation in the comment to save readers time from
following the bouncing ball to make sure.

--
Daniel Gustafsson        https://vmware.com/


Вложения

В списке pgsql-hackers по дате отправления:

Предыдущее
От: Boris Kolpackov
Дата:
Сообщение: Re: Pipeline mode and PQpipelineSync()
Следующее
От: Andrew Dunstan
Дата:
Сообщение: Re: pgindent run