When IP6_EXTHDR_GET fails, return ENOBUFS, and don't log an error (HDROPS

is not supposed to be used here).
This commit is contained in:
maxv 2018-05-01 08:27:13 +00:00
parent 72be6dafa1
commit 187c068ea2
2 changed files with 7 additions and 9 deletions

View File

@ -1,4 +1,4 @@
/* $NetBSD: xform_ah.c,v 1.96 2018/05/01 08:16:34 maxv Exp $ */
/* $NetBSD: xform_ah.c,v 1.97 2018/05/01 08:27:13 maxv Exp $ */
/* $FreeBSD: xform_ah.c,v 1.1.4.1 2003/01/24 05:11:36 sam Exp $ */
/* $OpenBSD: ip_ah.c,v 1.63 2001/06/26 06:18:58 angelos Exp $ */
/*
@ -39,7 +39,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: xform_ah.c,v 1.96 2018/05/01 08:16:34 maxv Exp $");
__KERNEL_RCSID(0, "$NetBSD: xform_ah.c,v 1.97 2018/05/01 08:27:13 maxv Exp $");
#if defined(_KERNEL_OPT)
#include "opt_inet.h"
@ -532,10 +532,8 @@ ah_input(struct mbuf *m, struct secasvar *sav, int skip, int protoff)
/* XXX don't pullup, just copy header */
IP6_EXTHDR_GET(ah, struct newah *, m, skip, rplen);
if (ah == NULL) {
DPRINTF(("%s: cannot pullup header\n", __func__));
error = ENOBUFS;
stat = AH_STAT_HDROPS; /*XXX*/
goto bad;
/* m already freed */
return ENOBUFS;
}
nxt = ah->ah_nxt;

View File

@ -1,4 +1,4 @@
/* $NetBSD: xform_esp.c,v 1.84 2018/05/01 08:16:34 maxv Exp $ */
/* $NetBSD: xform_esp.c,v 1.85 2018/05/01 08:27:13 maxv Exp $ */
/* $FreeBSD: xform_esp.c,v 1.2.2.1 2003/01/24 05:11:36 sam Exp $ */
/* $OpenBSD: ip_esp.c,v 1.69 2001/06/26 06:18:59 angelos Exp $ */
@ -39,7 +39,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: xform_esp.c,v 1.84 2018/05/01 08:16:34 maxv Exp $");
__KERNEL_RCSID(0, "$NetBSD: xform_esp.c,v 1.85 2018/05/01 08:27:13 maxv Exp $");
#if defined(_KERNEL_OPT)
#include "opt_inet.h"
@ -312,7 +312,7 @@ esp_input(struct mbuf *m, struct secasvar *sav, int skip, int protoff)
IP6_EXTHDR_GET(esp, struct newesp *, m, skip, sizeof(struct newesp));
if (esp == NULL) {
/* m already freed */
return EINVAL;
return ENOBUFS;
}
esph = sav->tdb_authalgxform;