On Friday, 14. October 2011 17:50:14 Dan Williams wrote: > > Good catch, I missed the memset() call. > > > > And if readlink() doesn't fill the buffer, > > > > > the remaining bytes will already be set to 0 by the memset, AFAICT. > > > Are you seeing a crash here or was this from visual inspection? > > > > Pure visual inspection, I was looking for readlink() usage patterns. > > > > Still the buf[link_len] = '0'; is more explicit and we wouldn't need > > the memset() call at all. What do you think? > > I try to do the memset() calls specifically to prevent bugs caused by > forgetting to do NULL termination later on; it's kind of the shotgun > approach but these paths generally aren't performance sensitive and I > think the tradeoff of a few cycles to memset (which is a very optimized > operation these days) is worth the decreased possibility of bugs and > buffer overruns here. At least that was my thought :)
Yeah, performance is not an issue here. So let's keep it like it is. Cheers, Thomas _______________________________________________ networkmanager-list mailing list networkmanager-list@gnome.org http://mail.gnome.org/mailman/listinfo/networkmanager-list