Follow @Openwall on Twitter for new release announcements and other news
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date: Fri, 8 Feb 2013 14:18:07 -0600
From: "jfoug" <>
To: <>
Subject: RE: C for dummies

From: magnum [] 
>This question stems from an OpenCL problem we just solved off list.
>In common.c we have several lines like this:
>char itoa16u[16] = "0123456789ABCDEF";
>Is this a bug or not? That string literal is 17 bytes if you ask me. In the
OpenCL format we were debugging, this caused major problems.
>I am 100% autodidact, so I am not sure the above way of writing it is
definitely wrong or not (my guess is it is wrong). Personally I would write
it with empty braces (btw I'd also use const). OTOH if it's that bad, I'm
puzzled no compiler or tool complained about it.

That is a bug.  I have had to make 'changes' for other build environments,
when taking code from Jtr.  I am not really sure HOW it builds properly in

I would much rather see this as 
const char itoa16u[] = "0123456789ABCDEF";

const char itoa16u[16] =

if we had to maintain sizeof(itoa16u) == 16 for something.

I also do not know why compilers were not complaining. When I cut those
lines out and put them into other packages, (like the recent wpapcap2john
project), I did get compiler errors about too many elements, and had to
change the var declaration.

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.