Thank you, Tom. You’re absolutely right―this change is not necessary. I’ve 
updated the patch accordingly.
Best regards,
Haibo

________________________________
发件人: Tom Lane <t...@sss.pgh.pa.us>
发送时间: 2025年6月16日 12:46
收件人: Yan Haibo <haibo....@hotmail.com>
抄送: Peter Eisentraut <pe...@eisentraut.org>; pgsql-hackers@lists.postgresql.org 
<pgsql-hackers@lists.postgresql.org>
主题: Re: 回复: 回复: Fix potential overflow risks from wcscpy and sprintf

Yan Haibo <haibo....@hotmail.com> writes:
> Regarding the use of wcsncpy with LOCALE_NAME_MAX_LENGTH - 1, it is a 
> precaution in case the input string is not null-terminated.

I don't think it's a "precaution".  I think it's introducing a real
bug (that is, failure on a locale name of exactly the max allowed
length) to prevent a hypothetical bug.

                        regards, tom lane

Attachment: 0001-Mitigate-potential-overflow-risks-from-wcscpy.patch
Description: 0001-Mitigate-potential-overflow-risks-from-wcscpy.patch

Reply via email to