Date: Thu, 15 Jul 1999 19:53:04 -0600 From: Brett Glass <brett@lariat.org> To: Warner Losh <imp@village.org> Cc: Sheldon Hearn <sheldonh@uunet.co.za>, Paul Hart <hart@iserver.com>, freebsd-security@FreeBSD.ORG Subject: Re: OpenBSD's strlcpy(3) and strlcat(3) Message-ID: <4.2.0.58.19990715194914.045ee7d0@localhost> In-Reply-To: <199907160016.SAA01040@harmony.village.org> References: <Your message of "Thu, 15 Jul 1999 18:05:06 MDT." <4.2.0.58.19990715180119.04723d20@localhost> <4.2.0.58.19990715180119.04723d20@localhost> <Your message of "Thu, 15 Jul 1999 17:47:03 CST." <4.2.0.58.19990715174241.045f0550@localhost>
next in thread | previous in thread | raw e-mail | index | archive | help
I agree with you. What I was suggesting, though, is that the SHORTFALL be the return value. Why? Because it facilitates a conditional test for truncation. If the return value is the number of bytes copied, one must do additional arithmetic to test for an error. Since OpenBSD is the only platform currently integrating the functions, there's time to work with them to make this the standard if we'd like. --Brett At 06:16 PM 7/15/99 -0600, Warner Losh wrote: >In message <4.2.0.58.19990715180119.04723d20@localhost> Brett Glass writes: >: Or, even better, ALWAYS return the shortfall. The programmer can then discard >: the return value if he's really willing to ignore it (perhaps at his peril). > >That's what strl* are defined to do. They always return the length of >the string that would have resulted, had it not been truncated. That >way it can either be used or ignored as the programmer sees fit. I >don't see much value in computing return-value - size as another, >incompatible argument. > >Warner To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-security" in the body of the message
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?4.2.0.58.19990715194914.045ee7d0>