[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [PATCH v1] tools: fix usage of strncpy



On Mon, Jun 8, 2020 at 10:11 AM Olaf Hering <olaf@xxxxxxxxx> wrote:
>
> Am Mon, 8 Jun 2020 08:43:50 -0400
> schrieb Jason Andryuk <jandryuk@xxxxxxxxx>:
>
> > I added a length check in this patch:
>
> gcc will not recognize such runtime checks and will (most likely) complain 
> about the strncpy usage anyway, just as it does now in 
> libxl__prepare_sockaddr_un. While the usage in libxl__prepare_sockaddr_un is 
> fatal due to -Werror, libvchan is apparently built without -Werror.

gcc complaining about strncpy after the length check is unfortunate.
Do you know if gcc would complain if strcpy is used?  It would be okay
since we just checked the length.

What version of gcc are you using?  I was using 9.x and it didn't warn
from what I can remember.

Regards,
Jason



 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.