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 for Android: free password hash cracker in your pocket
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:	Wed, 25 Aug 2010 08:10:20 +0800
From:	Changli Gao <xiaosuo@...il.com>
To:	Joe Perches <joe@...ches.com>
Cc:	akpm@...ux-foundation.org, linux-kernel@...r.kernel.org
Subject: Re: [PATCH] lib: fix scnprintf() if @size is == 0

On Wed, Aug 25, 2010 at 8:03 AM, Joe Perches <joe@...ches.com> wrote:
>
> Isn't simpler to check size at the beginning of the function?
>
> diff --git a/lib/vsprintf.c b/lib/vsprintf.c
> index 7af9d84..779236f 100644
> --- a/lib/vsprintf.c
> +++ b/lib/vsprintf.c
> @@ -1505,6 +1505,9 @@ int scnprintf(char *buf, size_t size, const char *fmt, ...)
>        va_list args;
>        int i;
>
> +       if (!size)
> +               return 0;
> +

It is a rare case, so don't slow down the normal users.

>        va_start(args, fmt);
>        i = vsnprintf(buf, size, fmt, args);
>        va_end(args);
>
>
>



-- 
Regards,
Changli Gao(xiaosuo@...il.com)
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ