Re: RFC: libkern version of inet_ntoa_r

看板FB_current作者時間13年前 (2012/07/29 07:01), 編輯推噓0(000)
留言0則, 0人參與, 最新討論串5/17 (看更多)
On Sat, Jul 28, 2012 at 3:35 PM, Arnaud Lacombe <lacombar@gmail.com> wrote: > Hi, > > On Sat, Jul 28, 2012 at 6:14 PM, Bjoern A. Zeeb > <bzeeb-lists@lists.zabbadoz.net> wrote: >> On Wed, 25 Jul 2012, Luigi Rizzo wrote: >> >>> During some ipfw/dummynet cleanup i noticed that the libkern version of >>> inet_ntoa_r() is missing the buffer size argument that is present in >>> the libc counterpart. >>> >>> Any objection if i fix it ? >> >> >> And why exactly would you need it? What does libc do with it? Render >> partial IPv4 addresses? >> > Mitigate possibilities of memory corruption ? At the very least, allow > the following: > > { > char tmp[sizeof "255.255.255.255"]; > > KASSERT(size >= (sizeof tmp)); > [...] > } > > to be enforced... but hey, who gives a damn about consistently doing > things and enforcing code assumptions ? ;-) I think that a subtlety in Bjoern's reply was missed. Note that inet_ntoa is guaranteed to only work with IPv4, not IPv4+IPv6, like inet_ntop. Thanks, -Garrett _______________________________________________ freebsd-current@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/freebsd-current To unsubscribe, send any mail to "freebsd-current-unsubscribe@freebsd.org"
文章代碼(AID): #1G56yk8H (FB_current)
討論串 (同標題文章)
文章代碼(AID): #1G56yk8H (FB_current)