pgsql: Use Size rather than int for storing strnlen's return

Поиск
Список
Период
Сортировка
Искать

pgsql: Use Size rather than int for storing strnlen's return

От:
David Rowley <drowley@postgresql.org>
Дата:
Use Size rather than int for storing strnlen's return

... in fe_memutils.c's pnstrdup().

strnlen() does return size_t, so it seems better to use the Size input
parameter to store the return value rather than demote it to int and
risk larger values being truncated.

Pushing only to master as this doesn't seem like an actual problem.
Fixing will hopefully prevent future LLM-triggered reports about this.

Author: Chao Li 
Discussion: https://postgr.es/m/0E717E09-809F-4BC4-B3B1-36BE729DBFAE@gmail.com

Branch
------
master

Details
-------
https://git.postgresql.org/pg/commitdiff/38c3d87d43397ab600f085e398789f3dea1cd0a5

Modified Files
--------------
src/common/fe_memutils.c | 9 ++++-----
1 file changed, 4 insertions(+), 5 deletions(-)

FAQ