[PATCH v1] tools: fix usage of strncpy

2020-06-08 Thread Olaf Hering
In case of truncation no trailing zero will be added to the target string. Reduce the amount of bytes to copy by one to make sure a trailing zero always exists. In file included from /usr/include/string.h:495, from libxl_internal.h:38, from libxl_utils.c:20: In fu

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

2020-06-08 Thread Olaf Hering
Am Mon, 8 Jun 2020 09:28:54 +0200 schrieb Olaf Hering : > off-by-one error in libxl__prepare_sockaddr_un There is none, I had read the code backwards... Olaf pgpFP2LeUeAH4.pgp Description: Digitale Signatur von OpenPGP

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

2020-06-08 Thread Ian Jackson
Olaf Hering writes ("Re: [PATCH v1] tools: fix usage of strncpy"): > Am Mon, 8 Jun 2020 09:28:54 +0200 > schrieb Olaf Hering : > > off-by-one error in libxl__prepare_sockaddr_un > > There is none, I had read the code backwards... I have just had the same though

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

2020-06-08 Thread Jason Andryuk
On Mon, Jun 8, 2020 at 7:03 AM Ian Jackson wrote: > > Olaf Hering writes ("Re: [PATCH v1] tools: fix usage of strncpy"): > > Am Mon, 8 Jun 2020 09:28:54 +0200 > > schrieb Olaf Hering : > > > off-by-one error in libxl__prepare_sockaddr_un > > >

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

2020-06-08 Thread Olaf Hering
Am Mon, 8 Jun 2020 08:43:50 -0400 schrieb Jason Andryuk : > 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_socka

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

2020-06-09 Thread Jason Andryuk
On Mon, Jun 8, 2020 at 10:11 AM Olaf Hering wrote: > > Am Mon, 8 Jun 2020 08:43:50 -0400 > schrieb Jason Andryuk : > > > 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 >

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

2020-06-09 Thread Olaf Hering
Am Tue, 9 Jun 2020 08:33:12 -0400 schrieb Jason Andryuk : > What version of gcc are you using? I was using 9.x and it didn't warn from > what I can remember. This is gcc10 from current Tumbleweed. For libxl strcpy will certainly work because the length check is done prior the copying of data.

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

2020-06-09 Thread Rich Persaud
On Jun 8, 2020, at 10:12, Olaf Hering wrote: > > Am Mon, 8 Jun 2020 08:43:50 -0400 > schrieb Jason Andryuk : > >> 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 > li

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

2020-06-09 Thread Olaf Hering
Am Tue, 9 Jun 2020 12:35:51 -0400 schrieb Rich Persaud : > Is there any reason not to take a patch that builds libvchan with -Werror? The per-subdirectory settings of -Werror should probably become a global -Werror. Someone has to step up and explore that path. Bonus points if -Werror could be d