Hi,

While reading code during patch review, I noticed that the frontend pnstrdup() 
defined in fe_memutils.c uses an int len to store the string length returned by 
strnlen(). Since strnlen() returns a size_t, in theory this could cause integer 
truncation or signed overflow, though in practice it should be very unlikely to 
happen.

The backend pnstrdup() defined in mcxt.c doesn't have this problem. It keeps 
the string length in a Size.

The attached patch is a trivial fix for the frontend pnstrdup(), reusing the 
existing "Size size" variable to store the result of strnlen().

Best regards,
--
Chao Li (Evan)
HighGo Software Co., Ltd.
https://www.highgo.com/




Attachment: v1-0001-Fix-integer-truncation-in-frontend-pnstrdup.patch
Description: Binary data

Reply via email to