- npfvar_get_type1: check for NULL first.

- Minor fix for the npf(7) man page.
This commit is contained in:
rmind 2015-07-12 23:54:43 +00:00
parent 810dfeba15
commit 87af5b04d3
2 changed files with 8 additions and 8 deletions

View File

@ -1,4 +1,4 @@
.\" $NetBSD: npf.7,v 1.2 2014/08/10 19:09:43 rmind Exp $
.\" $NetBSD: npf.7,v 1.3 2015/07/12 23:54:43 rmind Exp $
.\"
.\" Copyright (c) 2009-2014 The NetBSD Foundation, Inc.
.\" All rights reserved.
@ -27,7 +27,7 @@
.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
.\" POSSIBILITY OF SUCH DAMAGE.
.\"
.Dd August 2, 2014
.Dd July 13, 2015
.Dt NPF 7
.Os
.Sh NAME
@ -69,7 +69,7 @@ Traffic normalization (extension).
Packet logging (extension).
.El
.Pp
For a full set features and their description, see the NPF
For a full set of features and their description, see the NPF
documentation and other manual pages.
.\" -----
.Sh SEE ALSO

View File

@ -1,4 +1,4 @@
/* $NetBSD: npf_var.c,v 1.8 2013/11/19 00:28:41 rmind Exp $ */
/* $NetBSD: npf_var.c,v 1.9 2015/07/12 23:54:44 rmind Exp $ */
/*-
* Copyright (c) 2011-2012 The NetBSD Foundation, Inc.
@ -30,7 +30,7 @@
*/
#include <sys/cdefs.h>
__RCSID("$NetBSD: npf_var.c,v 1.8 2013/11/19 00:28:41 rmind Exp $");
__RCSID("$NetBSD: npf_var.c,v 1.9 2015/07/12 23:54:44 rmind Exp $");
#include <stdlib.h>
#include <string.h>
@ -239,14 +239,14 @@ npfvar_get_type1(const npfvar_t *vp, size_t idx, size_t level)
{
npf_element_t *el;
if (vp == NULL)
return -1;
if (level >= var_num) {
yyerror("variable loop for '%s'", vp->v_key);
return -1;
}
if (vp == NULL)
return -1;
if (vp->v_count <= idx) {
yyerror("variable '%s' has only %zu elements, requested %zu",
vp->v_key, vp->v_count, idx);