summaryrefslogtreecommitdiffstats
path: root/sys/netinet/ip_gre.c
diff options
context:
space:
mode:
authorbz <bz@FreeBSD.org>2006-01-21 10:44:34 +0000
committerbz <bz@FreeBSD.org>2006-01-21 10:44:34 +0000
commit6d9ab80fce79d4befb78b6264b0cfe789cdeac58 (patch)
tree6592dbe525d1fa703ba65343df6cd7f697d18423 /sys/netinet/ip_gre.c
parent0da5dd341ca939cb09f09ca6e0b9d4b978a60690 (diff)
downloadFreeBSD-src-6d9ab80fce79d4befb78b6264b0cfe789cdeac58.zip
FreeBSD-src-6d9ab80fce79d4befb78b6264b0cfe789cdeac58.tar.gz
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
Diffstat (limited to 'sys/netinet/ip_gre.c')
-rw-r--r--sys/netinet/ip_gre.c28
1 files changed, 3 insertions, 25 deletions
diff --git a/sys/netinet/ip_gre.c b/sys/netinet/ip_gre.c
index 04dc3d9..e9a2ace 100644
--- a/sys/netinet/ip_gre.c
+++ b/sys/netinet/ip_gre.c
@@ -104,20 +104,10 @@ static int gre_input2(struct mbuf *, int, u_char);
* This really is simple
*/
void
-#if __STDC__
-gre_input(struct mbuf *m, ...)
-#else
-gre_input(m, va_alist)
- struct mbuf *m;
- va_dcl
-#endif
+gre_input(struct mbuf *m, int off)
{
- int off, ret, proto;
- va_list ap;
+ int ret, proto;
- va_start(ap, m);
- off = va_arg(ap, int);
- va_end(ap);
proto = (mtod(m, struct ip *))->ip_p;
ret = gre_input2(m, off, proto);
@@ -236,25 +226,13 @@ gre_input2(struct mbuf *m ,int hlen, u_char proto)
*/
void
-#if __STDC__
-gre_mobile_input(struct mbuf *m, ...)
-#else
-gre_mobile_input(m, va_alist)
- struct mbuf *m;
- va_dcl
-#endif
+gre_mobile_input(struct mbuf *m, int hlen)
{
struct ip *ip;
struct mobip_h *mip;
struct gre_softc *sc;
- int hlen;
- va_list ap;
int msiz;
- va_start(ap, m);
- hlen = va_arg(ap, int);
- va_end(ap);
-
if ((sc = gre_lookup(m, IPPROTO_MOBILE)) == NULL) {
/* No matching tunnel or tunnel is down. */
m_freem(m);
OpenPOWER on IntegriCloud