[pacman-dev] [PATCH 1/2] Remove most usages of strncmp()

Allan McRae allan at archlinux.org
Tue Jul 5 22:17:27 EDT 2011


On 06/07/11 05:20, Dan McGee wrote:
> The supposed safety blanket of this function is better handled by
> explicit length checking and usages of strlen() on known NULL-terminated
> strings rather than hoping things fit in a buffer. We also have no need
> to fully fill a PATH_MAX length variable with NULLs every time as long
> as a single terminating byte is there. Remove usages of it by using
> strcpy() or memcpy() as appropriate, after doing length checks via
> strlen().
>
> Signed-off-by: Dan McGee<dan at archlinux.org>

Ack-by: Allan



More information about the pacman-dev mailing list