[Gc] Interior pointers
bruce at hoult.org
Fri Dec 28 21:47:13 PST 2012
Grr. Forgot an &
(size_t)(&((struct linux_dirent *)0)->d_name)
On Sat, Dec 29, 2012 at 6:44 PM, Bruce Hoult <bruce at hoult.org> wrote:
> int off_to_name = sizeof(long) + sizeof(off_t) + sizeof(short);
> That's not reliable, though it seems to be working for you. Things an
> be packed to different sizes when they are in structures than when
> they are stand-alone.
> Look up offsetof(), or at least use (size_t)(((struct linux_dirent*)0)->d_name)
> /* array holding pointers to 5000 names */
> char **allnames = (char **) GC_MALLOC(5000);
> Not unless pointers are 1 byte on your machine.
> So, this array is overflowing, as guessed by both of us.
> On Sat, Dec 29, 2012 at 6:21 PM, Michael Talbot-Wilson <mtw at view.net.au> wrote:
>> Guys, thanks. Here is the full program. (Assuming I can send an
>> attachment to this mailing list.)
>> Hope you can put me straight.
>> Gc mailing list
>> Gc at linux.hpl.hp.com
More information about the Gc