[svn.haxx.se] · SVN Dev · SVN Users · SVN Org · TSVN Dev · TSVN Users · Subclipse Dev · Subclipse Users · this month's index

Re: [PATCH] Out of bounds array access in hooks.c

From: Karl Fogel <kfogel_at_red-bean.com>
Date: 2007-12-12 09:23:24 CET

Philip Martin <philip@codematters.co.uk> writes:
> Karl Fogel <kfogel@red-bean.com> writes:
>> Thanks, Daniel and David. That was my bad, I think. It passed all my
>> testing too; I have no idea what the compiler was doing with array
>> allocation such that there was always room, but I wish it hadn't :-).
>
> You could use this technique:
>
> int i = 0;
> const char *args[3];
>
> args[i++] = ...;
> args[i++] = ...;
> args[i++] = ...;
>
> assert(i == sizeof(args)/sizeof(args[0]));

Neat trick! I may use it next time.

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org
Received on Wed Dec 12 09:23:39 2007

This is an archived mail posted to the Subversion Dev mailing list.

This site is subject to the Apache Privacy Policy and the Apache Public Forum Archive Policy.