Thanks Todd. I'll pass your analysis on to Joachim.

Date: Tue, 09 Mar 2021 14:14:33 -0700
From: Todd C. Miller <todd.mil...@sudo.ws>
To: Mark Lumsden <c...@sdf.org>
Cc: tech@openbsd.org
Subject: Re: mg: Fix Coverity Scan warning: Insecure data handling
On Tue, 09 Mar 2021 20:14:19 +0000, Mark Lumsden wrote:

Here is a diff from Joachim Wiberg's version of mg.

"The strlcpy() function is guaranteed to never copy more than 'len - 1'
bytes, so there is no need to check if we copied more.  This is a bogus
warning since the introduction of strlcpy()."

That looks wrong to me.  strlcpy() returns the number of bytes it
would have copied if there was space.  But if there was insufficient
space then the return value can be larger.  It is not safe to blindly
use the return value without checking it first.

- todd


Reply via email to