Re: [PATCH 1/4] last: fix format overflow

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

 



On Sat, May 27, 2017 at 07:24:06PM +0100, Sami Kerola wrote:
> login-utils/last.c:624:23: warning: '%s' directive writing up to 31 bytes
> into a region of size 27 [-Wformat-overflow=]
> 
> Signed-off-by: Sami Kerola <kerolasa@xxxxxx>
> ---
>  login-utils/last.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/login-utils/last.c b/login-utils/last.c
> index 679ea6c12..153130ac0 100644
> --- a/login-utils/last.c
> +++ b/login-utils/last.c
> @@ -598,7 +598,7 @@ static void __attribute__((__noreturn__)) usage(const struct last_control *ctl,
>  static int is_phantom(const struct last_control *ctl, struct utmpx *ut)
>  {
>  	struct passwd *pw;
> -	char path[32];
> +	char path[sizeof("/dev/") + sizeof(ut->ut_line) + 1];

 I have applied patches from Rudi with NAME_MAX.

    Karel


-- 
 Karel Zak  <kzak@xxxxxxxxxx>
 http://karelzak.blogspot.com
--
To unsubscribe from this list: send the line "unsubscribe util-linux" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html



[Index of Archives]     [Netdev]     [Ethernet Bridging]     [Linux Wireless]     [Kernel Newbies]     [Security]     [Linux for Hams]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux Admin]     [Samba]

  Powered by Linux