(racoon 736) Re: racoon + Cisco VPN Client
Derek Atkins <[email protected]> Tue, 14 Sep 2004 11:16:20 -0400
| Newsgroups | gmane.network.ipv6.kame.racoon |
|---|---|
| Message-ID | <[email protected]> |
Hi, Richard Whalen <[email protected]> writes: > I have been working on merging these changes with changes to allow Racoon to > be used with MultiNet on VMS, and came across the following in isakmp.c that > is questionable: > > /* > * set values into allocated buffer of isakmp header for phase 1 > */ > struct isakmp_construct > set_isakmp_header(vbuf, iph1) > vchar_t *vbuf; > struct ph1handle *iph1; > { > struct isakmp *isakmp; > struct isakmp_construct res; [snip] > res.np=&(isakmp->np); > res.buff=vbuf->v + sizeof(*isakmp); > > return res; > } > > > Notice that res is declared as a (stack) local variable, and is returned as > the value of the function. This will lead to corruption. This is perfectly legal C. It's returning a structure by value (not by reference). The caller function is expecting the structure to get filled in. The contents of res are filled in, effectively, by the argument vbuf. So, no problems here unless you have a compiler bug. It's perfectly legal to set a structure. -derek -- Derek Atkins 617-623-3745 [email protected] www.ihtfp.com Computer and Internet Security Consultant