summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authoremaste <emaste@FreeBSD.org>2007-03-02 14:36:19 +0000
committeremaste <emaste@FreeBSD.org>2007-03-02 14:36:19 +0000
commitc199a9f3a2957206e30a3f063112f182a786e77c (patch)
treee301c7da66418e7014b2f835d484d19819072163
parentf395a3de683cb0f727deff15c8bb1efa89bf15a5 (diff)
downloadFreeBSD-src-c199a9f3a2957206e30a3f063112f182a786e77c.zip
FreeBSD-src-c199a9f3a2957206e30a3f063112f182a786e77c.tar.gz
Ensure message passed to "settimestamp" and "setcounter" is the right
length. Use NULL instead of 0. Submitted by: glebius, ru
-rw-r--r--sys/netgraph/ng_source.c10
1 files changed, 9 insertions, 1 deletions
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;
}
/*
OpenPOWER on IntegriCloud