summaryrefslogtreecommitdiffstats
path: root/sys/netgraph
diff options
context:
space:
mode:
authorbrian <brian@FreeBSD.org>2002-06-22 21:00:53 +0000
committerbrian <brian@FreeBSD.org>2002-06-22 21:00:53 +0000
commitc8d1b9c9f6c963f078b5c1a6bd397cff34c5fe0b (patch)
tree26d49521e6b538f23ff3bd85e337909fdad29b33 /sys/netgraph
parent398085672a83ed9453604b35bff53647a877b778 (diff)
downloadFreeBSD-src-c8d1b9c9f6c963f078b5c1a6bd397cff34c5fe0b.zip
FreeBSD-src-c8d1b9c9f6c963f078b5c1a6bd397cff34c5fe0b.tar.gz
NUL terminate the ACNAME passed to userland.
Diffstat (limited to 'sys/netgraph')
-rw-r--r--sys/netgraph/ng_pppoe.c7
1 files changed, 4 insertions, 3 deletions
diff --git a/sys/netgraph/ng_pppoe.c b/sys/netgraph/ng_pppoe.c
index 3832d84..6af5352 100644
--- a/sys/netgraph/ng_pppoe.c
+++ b/sys/netgraph/ng_pppoe.c
@@ -893,7 +893,7 @@ AAA
static int
send_acname(sessp sp, const struct pppoe_tag *tag)
{
- int error;
+ int error, tlen;
struct ng_mesg *msg;
struct ngpppoe_sts *sts;
@@ -903,8 +903,9 @@ send_acname(sessp sp, const struct pppoe_tag *tag)
return (ENOMEM);
sts = (struct ngpppoe_sts *)msg->data;
- strncpy(sts->hook, tag->tag_data,
- min(NG_HOOKLEN + 1, ntohs(tag->tag_len)));
+ tlen = min(NG_HOOKLEN, ntohs(tag->tag_len));
+ strncpy(sts->hook, tag->tag_data, tlen);
+ sts->hook[tlen] = '\0';
NG_SEND_MSG_ID(error, NG_HOOK_NODE(sp->hook), msg, sp->creator, NULL);
return (error);
OpenPOWER on IntegriCloud