From c199a9f3a2957206e30a3f063112f182a786e77c Mon Sep 17 00:00:00 2001 From: emaste Date: Fri, 2 Mar 2007 14:36:19 +0000 Subject: Ensure message passed to "settimestamp" and "setcounter" is the right length. Use NULL instead of 0. Submitted by: glebius, ru --- sys/netgraph/ng_source.c | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/sys/netgraph/ng_source.c b/sys/netgraph/ng_source.c index 0cc76d6..dad819a 100644 --- a/sys/netgraph/ng_source.c +++ b/sys/netgraph/ng_source.c @@ -434,6 +434,10 @@ ng_source_rcvmsg(node_p node, item_p item, hook_p lasthook) { struct ng_source_embed_info *embed; + if (msg->header.arglen != sizeof(*embed)) { + error = EINVAL; + goto done; + } embed = (struct ng_source_embed_info *)msg->data; bcopy(embed, &sc->embed_timestamp, sizeof(*embed)); @@ -457,6 +461,10 @@ ng_source_rcvmsg(node_p node, item_p item, hook_p lasthook) { struct ng_source_embed_cnt_info *embed; + if (msg->header.arglen != sizeof(*embed)) { + error = EINVAL; + goto done; + } embed = (struct ng_source_embed_cnt_info *)msg->data; if (embed->index >= NG_SOURCE_COUNTERS || !(embed->width == 1 || embed->width == 2 || @@ -663,7 +671,7 @@ ng_source_clr_data (sc_p sc) NG_FREE_M(m); } sc->queueOctets = 0; - sc->last_packet = 0; + sc->last_packet = NULL; } /* -- cgit v1.1