NUL terminate the ACNAME passed to userland.

This commit is contained in:
Brian Somers 2002-06-22 21:00:53 +00:00
parent ea8be05a6f
commit 9e6798e7c0
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=98636

View File

@ -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);