Date: Wed, 2 May 2012 18:06:01 +0400 From: Solar Designer <solar@...nwall.com> To: john-dev@...ts.openwall.com Subject: Re: wpapsk.h warnings Lukas, magnum - On Tue, May 01, 2012 at 11:57:05PM +0200, magnum wrote: > I get these warnings when building. The first one looks like an actual > bug to me, or maybe I misunderstand the code: > > In file included from opencl_wpapsk_fmt.c:15:0: > wpapsk.h: In function ???decode_hccap???: > wpapsk.h:102:9: warning: array subscript is above array bounds > [-Warray-bounds] > > The array is char but you write all the way to 118 * 3, no? I looked into this yesterday. The out-of-bounds writes look intentional (I think they're still within the struct, although I did not verify that), but there's assumption that they're permitted and that the struct is packed. We can only ensure the latter with specific compilers (such as with gcc's __attribute__((packed)), which we'll need to specify), although in practice I am not aware of cases of compilers inserting padding between fields of type char. I think it'd be best to rewrite this, maybe by using a union - one sufficiently large array union'ed with a struct - although that still depends on the struct being packed. Alexander
Powered by blists - more mailing lists
Confused about mailing lists and their use? Read about mailing lists on Wikipedia and check out these guidelines on proper formatting of your messages.