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, 27 Feb 2013 10:48:30 +0100
From:	Jiri Slaby <jslaby@...e.cz>
To:	Chen Gang <gang.chen@...anux.com>, Jiri Kosina <jkosina@...e.cz>,
	isdn@...ux-pingi.de, Greg KH <gregkh@...uxfoundation.org>
CC:	alan@...ux.intel.com, netdev <netdev@...r.kernel.org>
Subject: Re: [PATCH] drivers/isdn: checkng length to be sure not memory overflow

On 02/27/2013 10:05 AM, Chen Gang wrote:
> 
>   the length of cmd.parm.cmsg.para is 50 (MAX_CAPI_PARA_LEN).
>   the strlen(msg) may be more than 50 (Modem-Commandbuffer, less than 255).
>     isdn_tty_send_msg is called by isdn_tty_parse_at
>     the relative parameter is m->mdmcmd (atemu *m)
>     the relative command may be "+M..."
> 
>   so need check the length to be sure not memory overflow.
> 
> Signed-off-by: Chen Gang <gang.chen@...anux.com>
> ---
>  drivers/isdn/i4l/isdn_tty.c |    2 +-
>  1 files changed, 1 insertions(+), 1 deletions(-)
> 
> diff --git a/drivers/isdn/i4l/isdn_tty.c b/drivers/isdn/i4l/isdn_tty.c
> index d8a7d83..c3f0f99 100644
> --- a/drivers/isdn/i4l/isdn_tty.c
> +++ b/drivers/isdn/i4l/isdn_tty.c
> @@ -902,7 +902,7 @@ isdn_tty_send_msg(modem_info *info, atemu *m, char *msg)
>  	int j;
>  	int l;
>  
> -	l = strlen(msg);
> +	l = min(strlen(msg), sizeof(cmd.parm.cmsg.para) - 2);
>  	if (!l) {
>  		isdn_tty_modem_result(RESULT_ERROR, info);
>  		return;
> 

Yeah, looks sensible from the buffer overflow POV. I have no idea if
this is correct from the ISDN POV as we drop the end of the buffer. But
who cares, when nobody noticed in the past decade...

thanks,
-- 
js
suse labs
--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ