tpop3d-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[tpop3d-discuss]alternative implementation of alloc_struct(S, p)


From: Maurice van der Pot
Subject: [tpop3d-discuss]alternative implementation of alloc_struct(S, p)
Date: Mon, 13 Feb 2006 21:06:02 +0100

Hey guys,

I've been running into a problem with the gcc stack protector code that
surfaced because of the use of a locally declared variable in alloc_struct
(util.h:51).

It turns out that if alloc_struct is rewritten to look like this:

  #define alloc_struct(S, p)  do { p = xmalloc(sizeof *p); memset(p, 0, 
sizeof(*p)); } while (0)

then the problem disappears.

The bug in the stack protector will be taken care of, but since the alternative
code is also faster and uses less stack space than the original version of 
alloc_struct, 
you may want to consider it for inclusion in tpop3d.

For details, please read the following bug report and comment #10 and
#11 in particular:

  https://bugs.gentoo.org/show_bug.cgi?id=115285

Best regards,
Maurice.

P.S.: You can also drop the S parameter that way.

-- 
Maurice van der Pot

Gentoo Linux Developer   address@hidden     http://www.gentoo.org
Creator of BiteMe!       address@hidden   http://www.kfk4ever.com

Attachment: pgpsme9JXNLzR.pgp
Description: PGP signature


reply via email to

[Prev in Thread] Current Thread [Next in Thread]