Skip to content

Commit

Permalink
always check for optlen overrun.
Browse files Browse the repository at this point in the history
  • Loading branch information
itojun committed Oct 29, 2001
1 parent a87519f commit 30f01de
Showing 1 changed file with 10 additions and 10 deletions.
20 changes: 10 additions & 10 deletions kame/sys/netinet6/ah_core.c
@@ -1,4 +1,4 @@
/* $KAME: ah_core.c,v 1.46 2001/10/29 04:37:05 k-sugyou Exp $ */
/* $KAME: ah_core.c,v 1.47 2001/10/29 04:43:08 itojun Exp $ */

/*
* Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project.
Expand Down Expand Up @@ -1606,18 +1606,18 @@ ah6_calccksum(m, ahdat, len, algo, sav)
goto fail;
}
optlen = optp[1] + 2;
}

if (optp[0] & IP6OPT_MUTABLE) {
if (optp + optlen > optend) {
error = EINVAL;
m_free(n);
n = NULL;
goto fail;
}
bzero(optp + 2, optlen - 2);
}
if (optp + optlen > optend) {
error = EINVAL;
m_free(n);
n = NULL;
goto fail;
}

if (optp[0] & IP6OPT_MUTABLE)
bzero(optp + 2, optlen - 2);

optp += optlen;
}

Expand Down

0 comments on commit 30f01de

Please sign in to comment.