On Thu, 23 Dec 2010 18:41:24 +0100
"Kim Woelders" <k...@woelders.dk> wrote:

> On Thu, 23 Dec 2010 17:47:06 +0100, Enlightenment SVN  
> <no-re...@enlightenment.org> wrote:
> 
> > Log:
> > fix sizeof use, thanks to kim woelders
> >
> > Author:       discomfitor
> > Date:         2010-12-23 08:47:05 -0800 (Thu, 23 Dec 2010)
> > New Revision: 55739
> > Trac:         http://trac.enlightenment.org/e/changeset/55739
> >
> > Modified:
> >   trunk/e/src/bin/e_hints.c
> >
> > Modified: trunk/e/src/bin/e_hints.c
> > ===================================================================
> > --- trunk/e/src/bin/e_hints.c       2010-12-23 12:47:23 UTC (rev 55738)
> > +++ trunk/e/src/bin/e_hints.c       2010-12-23 16:47:05 UTC (rev 55739)
> > @@ -1435,7 +1435,8 @@
> >      int num, i;
> >     memset(state, 0, sizeof(state));
> > -    num = ecore_x_window_prop_card32_get(bd->client.win,  
> > E_ATOM_WINDOW_STATE, state, sizeof(state));
> > +    num = ecore_x_window_prop_card32_get(bd->client.win,  
> > E_ATOM_WINDOW_STATE,
> > +      state, sizeof(state) / sizeof(state[0]); /* ugly, but avoids  
> > possible future overflow if more states are added */
> >      if (!num) return;
> >     for (i = 0; (i < num) && (i < sizeof(state)); i++)
> >
> Sorry about going on here, but if the (i < sizeof(state)) condition makes  
> clang happy it's just silly.
> This check ensures that i < 4 but clang should be clever enough to see  
> that accessing state[1] is bad.
> 
> /Kim
Well yes, that's the point.  clang sees that it could potentially overflow the
buffer there and thus generates a warning.  it's super pedantic, but that's the
idea.

-- 
Mike Blumenkrantz
Zentific: We run the three-legged race individually.

------------------------------------------------------------------------------
Learn how Oracle Real Application Clusters (RAC) One Node allows customers
to consolidate database storage, standardize their database environment, and, 
should the need arise, upgrade to a full multi-node Oracle RAC database 
without downtime or disruption
http://p.sf.net/sfu/oracle-sfdevnl
_______________________________________________
enlightenment-devel mailing list
enlightenment-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/enlightenment-devel

Reply via email to