Re: [PATCH 30/32] strlen.3, wcslen.3: Add recommendations for safer variants
From: Alejandro Colomar (man-pages) <hidden>
Date: 2021-08-08 01:24:24
From: Alejandro Colomar (man-pages) <hidden>
Date: 2021-08-08 01:24:24
Hi Michael, On 8/8/21 3:20 AM, Michael Kerrisk (man-pages) wrote:
quoted
I have some doubts about this patch, but in a completely different sense: I don't know if I'm being a bit paranoid in treating user input. I've always been taught that I should program deffensively, but as time passes by, I realize myself that I was programming too much deffensively, and even introducing bugs in the error handling code. And in many cases, strings will always be NUL-terminated, so maybe I'm just passing around a wrong recommendation. What do you think about this?How about a sentence something like: [[ In cases where the input buffer may not contain a terminating null byte, .BR strnlen (3) should be used instead. ]] What do you think?
Yes, that's much better. Thanks! Alex
Thanks, Michael
-- Alejandro Colomar Linux man-pages comaintainer; https://www.kernel.org/doc/man-pages/ http://www.alejandro-colomar.es/