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] [thread-next>] [day] [month] [year] [list]
Message-Id: <0203A9B5-3035-49A1-AAB7-207EB638A080@dotat.at>
Date:	Fri, 14 Jan 2011 00:25:17 +0000
From:	Tony Finch <dot@...at.at>
To:	Jesper Juhl <jj@...osbits.net>
Cc:	"linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH] strncpy() will not \0 terminate result

This patch is incorrect. The strncpy is replacing "else" with "if  " so needs to copy exactly 4 bytes.

Tony.
--
f.anthony.n.finch  <dot@...at.at>  http://dotat.at/

On 13 Jan 2011, at 22:35, Jesper Juhl <jj@...osbits.net> wrote:

> Hi,
> 
> Mpass() in scripts/unifdef.c has this code:
>  strncpy(keyword, "if  ", 4);
> this will fail to \0 terminate the destination.
> Following patch should fix that up.
> 
> Signed-off-by: Jesper Juhl <jj@...osbits.net>
> ---
> unifdef.c |    2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/scripts/unifdef.c b/scripts/unifdef.c
> index 44d3978..d579249 100644
> --- a/scripts/unifdef.c
> +++ b/scripts/unifdef.c
> @@ -376,7 +376,7 @@ static void Idrop (void) { Fdrop();  ignoreon(); }
> static void Itrue (void) { Ftrue();  ignoreon(); }
> static void Ifalse(void) { Ffalse(); ignoreon(); }
> /* edit this line */
> -static void Mpass (void) { strncpy(keyword, "if  ", 4); Pelif(); }
> +static void Mpass (void) { strncpy(keyword, "if  ", 5); Pelif(); }
> static void Mtrue (void) { keywordedit("else\n");  state(IS_TRUE_MIDDLE); }
> static void Melif (void) { keywordedit("endif\n"); state(IS_FALSE_TRAILER); }
> static void Melse (void) { keywordedit("endif\n"); state(IS_FALSE_ELSE); }
> 
> -- 
> Jesper Juhl <jj@...osbits.net>            http://www.chaosbits.net/
> Don't top-post http://www.catb.org/~esr/jargon/html/T/top-post.html
> Plain text mails only, please.
> 
--
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