summaryrefslogtreecommitdiffstats
path: root/sys/netgraph/ng_base.c
diff options
context:
space:
mode:
authorjulian <julian@FreeBSD.org>2000-12-18 20:03:32 +0000
committerjulian <julian@FreeBSD.org>2000-12-18 20:03:32 +0000
commit0c949560a12dd18943b66fe09bd06d3c34e5cf7a (patch)
tree5466b04ac515e8d01f9b135b6c119744a1138d82 /sys/netgraph/ng_base.c
parente6bd476191c5b338634a02b0a6de56aa7f23cf37 (diff)
downloadFreeBSD-src-0c949560a12dd18943b66fe09bd06d3c34e5cf7a.zip
FreeBSD-src-0c949560a12dd18943b66fe09bd06d3c34e5cf7a.tar.gz
Divorce the kernel binary ABI version number from the message
format version number. (userland programs should not need to be recompiled when the netgraph kernel internal ABI is changed. Also fix modules that don;t handle the fact that a caller may not supply a return message pointer. (benign at the moment because the calling code checks, but that will change)
Diffstat (limited to 'sys/netgraph/ng_base.c')
-rw-r--r--sys/netgraph/ng_base.c16
1 files changed, 15 insertions, 1 deletions
diff --git a/sys/netgraph/ng_base.c b/sys/netgraph/ng_base.c
index 981d0bf..d9b26f4 100644
--- a/sys/netgraph/ng_base.c
+++ b/sys/netgraph/ng_base.c
@@ -856,7 +856,9 @@ ng_newtype(struct ng_type *tp)
const size_t namelen = strlen(tp->name);
/* Check version and type name fields */
- if (tp->version != NG_VERSION || namelen == 0 || namelen > NG_TYPELEN) {
+ if ((tp->version != NG_ABI_VERSION)
+ || (namelen == 0)
+ || (namelen > NG_TYPELEN)) {
TRAP_ERROR;
return (EINVAL);
}
@@ -1489,6 +1491,12 @@ ng_generic_msg(node_p here, struct ng_mesg *msg, const char *retaddr,
break;
}
+ /* Check response pointer */
+ if (resp == NULL) {
+ error = EINVAL;
+ break;
+ }
+
/* Get a response message with lots of room */
NG_MKRESPONSE(rp, msg, sizeof(*ascii) + bufSize, M_NOWAIT);
if (rp == NULL) {
@@ -1565,6 +1573,12 @@ ng_generic_msg(node_p here, struct ng_mesg *msg, const char *retaddr,
}
ascii->data[ascii->header.arglen - 1] = '\0';
+ /* Check response pointer */
+ if (resp == NULL) {
+ error = EINVAL;
+ break;
+ }
+
/* Get a response message with lots of room */
NG_MKRESPONSE(rp, msg, sizeof(*binary) + bufSize, M_NOWAIT);
if (rp == NULL) {
OpenPOWER on IntegriCloud