Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys return EINVAL if sin{, 6}_len != sizeof(sockaddr_in{, 6}) ...
details: https://anonhg.NetBSD.org/src/rev/3e821bb05179
branches: trunk
changeset: 807902:3e821bb05179
user: rtr <rtr%NetBSD.org@localhost>
date: Sun Apr 26 16:45:50 2015 +0000
description:
return EINVAL if sin{,6}_len != sizeof(sockaddr_in{,6}) respectively in
in{,6}_pcbconnect().
checking just m->m_len isn't enough because there are various places that
assume sa_len has been properly populated.
diffstat:
sys/netinet/in_pcb.c | 6 ++++--
sys/netinet6/in6_pcb.c | 6 ++++--
2 files changed, 8 insertions(+), 4 deletions(-)
diffs (54 lines):
diff -r 94fa13686bc8 -r 3e821bb05179 sys/netinet/in_pcb.c
--- a/sys/netinet/in_pcb.c Sun Apr 26 16:41:04 2015 +0000
+++ b/sys/netinet/in_pcb.c Sun Apr 26 16:45:50 2015 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: in_pcb.c,v 1.157 2015/04/24 22:32:37 rtr Exp $ */
+/* $NetBSD: in_pcb.c,v 1.158 2015/04/26 16:45:51 rtr Exp $ */
/*
* Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project.
@@ -93,7 +93,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: in_pcb.c,v 1.157 2015/04/24 22:32:37 rtr Exp $");
+__KERNEL_RCSID(0, "$NetBSD: in_pcb.c,v 1.158 2015/04/26 16:45:51 rtr Exp $");
#include "opt_inet.h"
#include "opt_ipsec.h"
@@ -461,6 +461,8 @@
if (nam->m_len != sizeof (*sin))
return (EINVAL);
+ if (sin->sin_len != sizeof (*sin))
+ return (EINVAL);
if (sin->sin_family != AF_INET)
return (EAFNOSUPPORT);
if (sin->sin_port == 0)
diff -r 94fa13686bc8 -r 3e821bb05179 sys/netinet6/in6_pcb.c
--- a/sys/netinet6/in6_pcb.c Sun Apr 26 16:41:04 2015 +0000
+++ b/sys/netinet6/in6_pcb.c Sun Apr 26 16:45:50 2015 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: in6_pcb.c,v 1.136 2015/04/24 22:32:37 rtr Exp $ */
+/* $NetBSD: in6_pcb.c,v 1.137 2015/04/26 16:45:50 rtr Exp $ */
/* $KAME: in6_pcb.c,v 1.84 2001/02/08 18:02:08 itojun Exp $ */
/*
@@ -62,7 +62,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: in6_pcb.c,v 1.136 2015/04/24 22:32:37 rtr Exp $");
+__KERNEL_RCSID(0, "$NetBSD: in6_pcb.c,v 1.137 2015/04/26 16:45:50 rtr Exp $");
#include "opt_inet.h"
#include "opt_ipsec.h"
@@ -446,6 +446,8 @@
if (nam->m_len != sizeof(*sin6))
return (EINVAL);
+ if (sin6->sin6_len != sizeof(*sin6))
+ return (EINVAL);
if (sin6->sin6_family != AF_INET6)
return (EAFNOSUPPORT);
if (sin6->sin6_port == 0)
Home |
Main Index |
Thread Index |
Old Index