Module Name: src
Committed By: christos
Date: Fri Feb 7 02:36:06 UTC 2014
Modified Files:
src/lib/libc/net: ip6opt.c
Log Message:
RFC 3542 (section 10.1) states that optlen should only be checked when
opt != NULL (Eitan Adler)
To generate a diff of this commit:
cvs rdiff -u -r1.14 -r1.15 src/lib/libc/net/ip6opt.c
Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.
Modified files:
Index: src/lib/libc/net/ip6opt.c
diff -u src/lib/libc/net/ip6opt.c:1.14 src/lib/libc/net/ip6opt.c:1.15
--- src/lib/libc/net/ip6opt.c:1.14 Tue Mar 20 13:44:18 2012
+++ src/lib/libc/net/ip6opt.c Thu Feb 6 21:36:06 2014
@@ -1,4 +1,4 @@
-/* $NetBSD: ip6opt.c,v 1.14 2012/03/20 17:44:18 matt Exp $ */
+/* $NetBSD: ip6opt.c,v 1.15 2014/02/07 02:36:06 christos Exp $ */
/*
* Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project.
@@ -31,7 +31,7 @@
#include <sys/cdefs.h>
#if defined(LIBC_SCCS) && !defined(lint)
-__RCSID("$NetBSD: ip6opt.c,v 1.14 2012/03/20 17:44:18 matt Exp $");
+__RCSID("$NetBSD: ip6opt.c,v 1.15 2014/02/07 02:36:06 christos Exp $");
#endif /* LIBC_SCCS and not lint */
#include "namespace.h"
@@ -442,11 +442,8 @@ inet6_opt_init(void *extbuf, socklen_t e
{
struct ip6_ext *ext = (struct ip6_ext *)extbuf;
- if (extlen % 8)
- return (-1);
-
if (ext) {
- if (extlen == 0)
+ if (extlen == 0 || (extlen % 8))
return (-1);
ext->ip6e_len = (extlen >> 3) - 1;
}