lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Date:   Wed, 26 Jul 2017 09:41:29 -0700 (PDT)
From:   David Miller <davem@...emloft.net>
To:     arnd@...db.de
Cc:     jreuter@...na.de, dhowells@...hat.com, linux-hams@...r.kernel.org,
        netdev@...r.kernel.org, linux-kernel@...r.kernel.org
Subject: Re: [PATCH] hamradio: dmascc: avoid -Wformat-overflow warning

From: Arnd Bergmann <arnd@...db.de>
Date: Wed, 26 Jul 2017 09:55:33 +0200

> gcc warns that the device name might overflow:
> 
> drivers/net/hamradio/dmascc.c: In function 'dmascc_init':
> drivers/net/hamradio/dmascc.c:584:22: error: 'sprintf' may write a terminating nul past the end of the destination [-Werror=format-overflow=]
>    sprintf(dev->name, "dmascc%i", 2 * n + i);
> drivers/net/hamradio/dmascc.c:584:3: note: 'sprintf' output between 8 and 17 bytes into a destination of size 16
>    sprintf(dev->name, "dmascc%i", 2 * n + i);
> 
> From the static data in this file, I can tell that the index is
> strictly limited to 16, so it won't overflow. This simply changes
> the sprintf() to snprintf(), which is a good idea in general,
> and shuts up this warning.
> 
> Signed-off-by: Arnd Bergmann <arnd@...db.de>

Applied to net-next.

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ