From 211326affcd6ad5c44082b9bf81f9a2e0ef39e7e Mon Sep 17 00:00:00 2001 From: Hartmut Brandt Date: Mon, 26 Jan 2004 14:57:49 +0000 Subject: [PATCH] Get rid of the old *LEN constants in favour of the new *SIZ constants that also include the trailing \0 byte. --- sys/netgraph/atm/ng_atm.c | 8 ++++---- sys/netgraph/atm/ng_atm.h | 4 ++-- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/sys/netgraph/atm/ng_atm.c b/sys/netgraph/atm/ng_atm.c index f1afeb1a88fa..1750cdd08412 100644 --- a/sys/netgraph/atm/ng_atm.c +++ b/sys/netgraph/atm/ng_atm.c @@ -991,7 +991,7 @@ ng_atm_rcvmsg(node_p node, item_p item, hook_p lasthook) case NGM_ATM_GET_VCC: { - char hook[NG_HOOKLEN + 1]; + char hook[NG_HOOKSIZ]; struct atmio_vcctable *vccs; struct ngvcc *vcc; u_int i; @@ -1000,12 +1000,12 @@ ng_atm_rcvmsg(node_p node, item_p item, hook_p lasthook) error = ENXIO; break; } - if (msg->header.arglen != NG_HOOKLEN + 1) { + if (msg->header.arglen != NG_HOOKSIZ) { error = EINVAL; break; } - strncpy(hook, msg->data, NG_HOOKLEN + 1); - hook[NG_HOOKLEN] = '\0'; + strncpy(hook, msg->data, NG_HOOKSIZ); + hook[NG_HOOKSIZ - 1] = '\0'; LIST_FOREACH(vcc, &priv->vccs, link) if (strcmp(NG_HOOK_NAME(vcc->hook), hook) == 0) break; diff --git a/sys/netgraph/atm/ng_atm.h b/sys/netgraph/atm/ng_atm.h index 675b437cab2e..ebf7cb69843c 100644 --- a/sys/netgraph/atm/ng_atm.h +++ b/sys/netgraph/atm/ng_atm.h @@ -126,7 +126,7 @@ struct ngm_atm_config { * Structure to open a VCC. */ struct ngm_atm_cpcs_init { - char name[NG_HOOKLEN + 1]; + char name[NG_HOOKSIZ]; uint32_t flags; /* flags. (if_atm.h) */ uint16_t vci; /* VCI to open */ uint16_t vpi; /* VPI to open */ @@ -177,7 +177,7 @@ struct ngm_atm_cpcs_init { * Structure to close a VCI without disconnecting the hook */ struct ngm_atm_cpcs_term { - char name[NG_HOOKLEN + 1]; + char name[NG_HOOKSIZ]; }; #define NGM_ATM_CPCS_TERM_INFO \ { \