Check parameters to avoid potential panic root user.

Patch checked by chopps@.
This commit is contained in:
is 2006-11-24 12:47:43 +00:00
parent 0c2df71a45
commit 9f6b10c456
1 changed files with 12 additions and 2 deletions

View File

@ -1,4 +1,4 @@
/* $NetBSD: esis.c,v 1.41 2006/11/16 01:33:51 christos Exp $ */
/* $NetBSD: esis.c,v 1.42 2006/11/24 12:47:43 is Exp $ */
/*-
* Copyright (c) 1991, 1993
@ -59,7 +59,7 @@ SOFTWARE.
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: esis.c,v 1.41 2006/11/16 01:33:51 christos Exp $");
__KERNEL_RCSID(0, "$NetBSD: esis.c,v 1.42 2006/11/24 12:47:43 is Exp $");
#include "opt_iso.h"
#ifdef ISO
@ -1114,6 +1114,16 @@ isis_output(struct mbuf *m, ...)
sdl = va_arg(ap, struct sockaddr_dl *);
va_end(ap);
/* we assume here we have a sockaddr_dl ... check it */
if (sdl->sdl_family != AF_LINK) {
error = EINVAL;
goto release;
}
if (sdl->sdl_len < 8 + sdl->sdl_nlen + sdl->sdl_alen + sdl->sdl_slen) {
error = EINVAL;
goto release;
}
ifa = ifa_ifwithnet((struct sockaddr *) sdl); /* get ifp from sdl */
if (ifa == 0) {
#ifdef ARGO_DEBUG