* Adam <[email protected]> [2014-09-19 10:37]: > On Fri, 19 Sep 2014 00:14:47 -0700 > Doug Hogan <[email protected]> wrote: > > On Thu, Sep 18, 2014 at 09:28:41AM +0100, [email protected] > > wrote: > > > + strlcpy(mountpoint, src, sizeof(mountpoint)); > > > > The strlcpy call should check for truncation. There's no guarantee > > that src is less than sizeof(mountpoint) since src = template = > > optarg. > > According to man strlcpy(3): > > "strlcpy() copies up to dstsize - 1 characters from the string src to > dst, NUL-terminating the result if dstsize is not 0." > > Thus, such a check here would be redundant.
HUH? Doug is entirely right. src is user controlled and can be larger than mountpoint. In that case, we want to bail and whine at the user instead of silently truncating and going on. -- Henning Brauer, [email protected], [email protected] BS Web Services GmbH, http://bsws.de, Full-Service ISP Secure Hosting, Mail and DNS. Virtual & Dedicated Servers, Root to Fully Managed Henning Brauer Consulting, http://henningbrauer.com/
