[PATCH xserver] xfree86: up the path name size to 512 in xf86MatchDriverFromFiles

walter harms wharms at bfs.de
Fri May 5 07:30:11 UTC 2017


if i remember correctly asprint() was added last year.
Would that be an option ?

re,
 wh

Am 05.05.2017 01:06, schrieb Peter Hutterer:
> ./hw/xfree86/common/xf86pciBus.c: In function ‘xf86MatchDriverFromFiles’:
> ./hw/xfree86/common/xf86pciBus.c:1330:52: warning: ‘snprintf’ output may be
> truncated before the last format character [-Wformat-truncation=]
>              snprintf(path_name, sizeof(path_name), "%s/%s", ^~~~~~~
> ./hw/xfree86/common/xf86pciBus.c:1330:13: note: ‘snprintf’ output between 2
> 
> dirent->d_name is 256, so sprintf("%s/%s") into a 256 buffer gives us:
> 
> and 257 bytes into a destination of size 256
> 
> Signed-off-by: Peter Hutterer <peter.hutterer at who-t.net>
> ---
>  hw/xfree86/common/xf86pciBus.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/hw/xfree86/common/xf86pciBus.c b/hw/xfree86/common/xf86pciBus.c
> index 0d0a76bc8..012ca08d2 100644
> --- a/hw/xfree86/common/xf86pciBus.c
> +++ b/hw/xfree86/common/xf86pciBus.c
> @@ -1303,7 +1303,7 @@ xf86MatchDriverFromFiles(uint16_t match_vendor, uint16_t match_chip,
>      char *line = NULL, *tmpMatch;
>      size_t len;
>      ssize_t read;
> -    char path_name[256], vendor_str[5], chip_str[5];
> +    char path_name[512], vendor_str[5], chip_str[5];
>      uint16_t vendor, chip;
>      int j;
>  


More information about the xorg-devel mailing list