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]
Date:	Mon, 18 May 2009 22:55:56 +0200
From:	Jiri Slaby <jirislaby@...il.com>
To:	Lai Jiangshan <laijs@...fujitsu.com>
CC:	Ingo Molnar <mingo@...e.hu>, Steven Rostedt <rostedt@...dmis.org>,
	Li Zefan <lizf@...fujitsu.com>,
	LKML <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH] tracing: use strlcpy instead of strncpy

On 05/18/2009 01:35 PM, Lai Jiangshan wrote:
> strlcpy() will add '\0' for the copied string.
> 
> [Impact] cleanup
...
> --- a/kernel/trace/trace_branch.c
> +++ b/kernel/trace/trace_branch.c
> @@ -67,10 +67,8 @@ probe_likely_condition(struct ftrace_branch_data *f, int val, int expect)
>  		p--;
>  	p++;
>  
> -	strncpy(entry->func, f->func, TRACE_FUNC_SIZE);
> -	strncpy(entry->file, p, TRACE_FILE_SIZE);
> -	entry->func[TRACE_FUNC_SIZE] = 0;
> -	entry->file[TRACE_FILE_SIZE] = 0;
> +	strlcpy(entry->func, f->func, TRACE_FUNC_SIZE);
> +	strlcpy(entry->file, p, TRACE_FILE_SIZE);

Hmm, this is not the same. +1 is missing here.
--
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