--- kame/kame/kame/racoon/Attic/isakmp.c 2004/03/03 05:39:58 1.180 +++ kame/kame/kame/racoon/Attic/isakmp.c 2004/03/31 03:14:39 1.181 @@ -1,4 +1,4 @@ -/* $KAME: isakmp.c,v 1.179 2003/11/13 02:30:20 sakane Exp $ */ +/* $KAME: isakmp.c,v 1.180 2004/03/03 05:39:58 sakane Exp $ */ /* * Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project. @@ -189,6 +189,18 @@ isakmp_handler(so_isakmp) goto end; } + /* reject it if the size is tooooo big. */ + if (ntohl(isakmp.len) > 0xffff) { + plog(LLV_ERROR, LOCATION, NULL, + "the length of the isakmp header is too big.\n"); + if ((len = recvfrom(so_isakmp, (char *)&isakmp, sizeof(isakmp), + 0, (struct sockaddr *)&remote, &remote_len)) < 0) { + plog(LLV_ERROR, LOCATION, NULL, + "failed to receive isakmp packet\n"); + } + goto end; + } + /* read real message */ if ((buf = vmalloc(ntohl(isakmp.len))) == NULL) { plog(LLV_ERROR, LOCATION, NULL,