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:	Wed, 17 Apr 2013 17:43:13 +0800
From:	Chen Gang <gang.chen@...anux.com>
To:	jason.wessel@...driver.com, anton.vorontsov@...aro.org,
	sasha.levin@...cle.com, vincent.stehle@...oste.net,
	john.blackwood@...r.com
CC:	kgdb-bugreport@...ts.sourceforge.net,
	"linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH] kernel: debug: kdb: strncpy issue, using strlcpy instead
 of strncpy.

Hello maintainers:

  please help check this patch, when you have time, thanks.


On 2013年04月07日 19:03, Chen Gang wrote:
> 
>   cmd_cur and cmd_hist[] are all NUL terminated string.
>   need using strlcpy instead of strncpy.
> 
> Signed-off-by: Chen Gang <gang.chen@...anux.com>
> ---
>  kernel/debug/kdb/kdb_main.c |    8 ++++----
>  1 files changed, 4 insertions(+), 4 deletions(-)
> 
> diff --git a/kernel/debug/kdb/kdb_main.c b/kernel/debug/kdb/kdb_main.c
> index 00eb8f7..a2b04d7 100644
> --- a/kernel/debug/kdb/kdb_main.c
> +++ b/kernel/debug/kdb/kdb_main.c
> @@ -1063,12 +1063,12 @@ static int handle_ctrl_cmd(char *cmd)
>  	case CTRL_P:
>  		if (cmdptr != cmd_tail)
>  			cmdptr = (cmdptr-1) % KDB_CMD_HISTORY_COUNT;
> -		strncpy(cmd_cur, cmd_hist[cmdptr], CMD_BUFLEN);
> +		strlcpy(cmd_cur, cmd_hist[cmdptr], CMD_BUFLEN);
>  		return 1;
>  	case CTRL_N:
>  		if (cmdptr != cmd_head)
>  			cmdptr = (cmdptr+1) % KDB_CMD_HISTORY_COUNT;
> -		strncpy(cmd_cur, cmd_hist[cmdptr], CMD_BUFLEN);
> +		strlcpy(cmd_cur, cmd_hist[cmdptr], CMD_BUFLEN);
>  		return 1;
>  	}
>  	return 0;
> @@ -1260,7 +1260,7 @@ do_full_getstr:
>  		if (*cmdbuf != '\n') {
>  			if (*cmdbuf < 32) {
>  				if (cmdptr == cmd_head) {
> -					strncpy(cmd_hist[cmd_head], cmd_cur,
> +					strlcpy(cmd_hist[cmd_head], cmd_cur,
>  						CMD_BUFLEN);
>  					*(cmd_hist[cmd_head] +
>  					  strlen(cmd_hist[cmd_head])-1) = '\0';
> @@ -1270,7 +1270,7 @@ do_full_getstr:
>  				cmdbuf = cmd_cur;
>  				goto do_full_getstr;
>  			} else {
> -				strncpy(cmd_hist[cmd_head], cmd_cur,
> +				strlcpy(cmd_hist[cmd_head], cmd_cur,
>  					CMD_BUFLEN);
>  			}
>  
> 


-- 
Chen Gang

Asianux Corporation
--
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