On 02/22/2011 09:30 PM, Marcus Meissner wrote:
Hi,
CID 1181. copying a pointer to a struct into a struct is likely bad, fixed.
- memcpy(&infoW,&info, sizeof(info));
- memcpy(&infoW, info, sizeof(*info));
Should probably use direct struct copying instead: infoW = *info;
Vitaliy.
On Wed, Feb 23, 2011 at 07:29:41AM -0700, Vitaliy Margolen wrote:
On 02/22/2011 09:30 PM, Marcus Meissner wrote:
Hi,
CID 1181. copying a pointer to a struct into a struct is likely bad, fixed.
- memcpy(&infoW,&info, sizeof(info));
- memcpy(&infoW, info, sizeof(*info));
Should probably use direct struct copying instead: infoW = *info;
Wont work, except if we cast the type.... :/
infoW is the _W struct, info a ptr to _A struct (both are the same size however).
Ciao, Marcus