[PATCH] Fix some warnings from Coverity

Jeremy Allison jra at samba.org
Fri Dec 2 17:53:38 UTC 2016


On Thu, Dec 01, 2016 at 10:21:21PM +0200, Uri Simchoni wrote:
> On 12/01/2016 09:54 PM, Volker Lendecke wrote:
> > On Thu, Dec 01, 2016 at 08:50:46PM +0100, Volker Lendecke wrote:
> >> On Thu, Dec 01, 2016 at 11:44:11AM -0800, Jeremy Allison wrote:
> >>> On Thu, Dec 01, 2016 at 08:34:37PM +0100, Andreas Schneider wrote:
> >>>> Hi,
> >>>>
> >>>> some minor things, they will make Coverity happy.
> >>>>
> >>>>
> >>>> Review and push appreciated.
> >>>
> >>> In:
> >>>
> >>> [PATCH 2/2] libsocket: Make sure ifr.ifr_name is null-terminated
> >>
> >> Does that have to be null-terminated for the ioctl at all?
> > 
> > Some cross-ref suggests not:
> > 
> > http://lxr.free-electrons.com/source/net/core/dev.c#L758
> > 
> > has a call to
> > 
> > if (!strncmp(dev->name, name, IFNAMSIZ))
> > 
> > which says it doesn't have to be null-terminated. No clue if that is
> > the right reference though.
> > 
> > If we null-terminate, we might miss weird long interface names.
> > 
> > Any insights someone?
> > 
> > Volker
> > 
> 
> We've been here before:
> https://lists.samba.org/archive/samba-technical/2016-February/111931.html
> 
> The conclusion then was that the ethtool utility expects it to be
> null-terminated and fit inside IFNAMSIZ with the zero termination, so we
> can do it too.

Andreas - ping. Are you OK with strlcpy ?



More information about the samba-technical mailing list