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] [day] [month] [year] [list]
Date:	Sat, 7 Nov 2015 00:57:55 +0300
From:	Dan Carpenter <dan.carpenter@...cle.com>
To:	Andy Shevchenko <andy.shevchenko@...il.com>
Cc:	Ivan Safonov <insafonov@...il.com>, devel@...verdev.osuosl.org,
	Bryan Paul <bryan.paul@...oo.com>,
	Vaishali Thakkar <vthakkar1994@...il.com>,
	Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
	"linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>,
	Larry Finger <Larry.Finger@...inger.net>
Subject: Re: [PATCH 2/3] staging: rtl8188eu: if/else replaced by min_t

On Fri, Nov 06, 2015 at 11:42:50PM +0200, Andy Shevchenko wrote:
> On Fri, Nov 6, 2015 at 5:18 PM, Ivan Safonov <insafonov@...il.com> wrote:

> >         psecuritypriv->authenticator_ie[0] = (unsigned char)psecnetwork->IELength;
> >
> > -       if ((psecnetwork->IELength-12) < (256-1))
> > -               memcpy(&psecuritypriv->authenticator_ie[1], &psecnetwork->IEs[12], psecnetwork->IELength-12);
> > -       else
> > -               memcpy(&psecuritypriv->authenticator_ie[1], &psecnetwork->IEs[12], (256-1));
> > +       memcpy(&psecuritypriv->authenticator_ie[1], &psecnetwork->IEs[12], min_t(int, psecnetwork->IELength - 12, 256 - 1));
> >
> 
> Run checkpatch.pl.

The long line was there in the original so it's forgivable but probably
should be changed in v2.

The main thing though is that this looks to introduce a memory
corruption but because the original used unsigned comparison and we have
changed it to doing "int" comparison.  It should be u32 like in the
original code.  Or size_t would be ok too.

> 
> 256 looks like sizeof(…).

Yup.

regards,
dan carpenter

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