aboutsummaryrefslogtreecommitdiff
path: root/sys/netipsec/keysock.c
diff options
context:
space:
mode:
authorBjoern A. Zeeb <bz@FreeBSD.org>2006-01-21 10:44:34 +0000
committerBjoern A. Zeeb <bz@FreeBSD.org>2006-01-21 10:44:34 +0000
commit3f2e28fe9ffbb70d26e5cc7abba248e981434853 (patch)
tree6592dbe525d1fa703ba65343df6cd7f697d18423 /sys/netipsec/keysock.c
parent25227ab8c5f3d382bd20ca46fec117d3d4dd19f8 (diff)
downloadsrc-3f2e28fe9ffbb70d26e5cc7abba248e981434853.tar.gz
src-3f2e28fe9ffbb70d26e5cc7abba248e981434853.zip
Fix stack corruptions on amd64.
Vararg functions have a different calling convention than regular functions on amd64. Casting a varag function to a regular one to match the function pointer declaration will hide the varargs from the caller and we will end up with an incorrectly setup stack. Entirely remove the varargs from these functions and change the functions to match the declaration of the function pointers. Remove the now unnecessary casts. Lots of explanations and help from: peter Reviewed by: peter PR: amd64/89261 MFC after: 6 days
Notes
Notes: svn path=/head/; revision=154625
Diffstat (limited to 'sys/netipsec/keysock.c')
-rw-r--r--sys/netipsec/keysock.c16
1 files changed, 2 insertions, 14 deletions
diff --git a/sys/netipsec/keysock.c b/sys/netipsec/keysock.c
index daff3c943848..12e458adc40c 100644
--- a/sys/netipsec/keysock.c
+++ b/sys/netipsec/keysock.c
@@ -77,23 +77,11 @@ struct pfkeystat pfkeystat;
* key_output()
*/
int
-#if __STDC__
-key_output(struct mbuf *m, ...)
-#else
-key_output(m, va_alist)
- struct mbuf *m;
- va_dcl
-#endif
+key_output(struct mbuf *m, struct socket *so)
{
struct sadb_msg *msg;
int len, error = 0;
int s;
- struct socket *so;
- va_list ap;
-
- va_start(ap, m);
- so = va_arg(ap, struct socket *);
- va_end(ap);
if (m == 0)
panic("%s: NULL pointer was passed.\n", __func__);
@@ -590,7 +578,7 @@ struct protosw keysw[] = {
.pr_domain = &keydomain,
.pr_protocol = PF_KEY_V2,
.pr_flags = PR_ATOMIC|PR_ADDR,
- .pr_output = (pr_output_t *)key_output,
+ .pr_output = key_output,
.pr_ctlinput = raw_ctlinput,
.pr_init = raw_init,
.pr_usrreqs = &key_usrreqs