Remember that I'm using length-defined strings in parameters:

Remove a bogus null terminator when stripping the netmask from
 IP addresses.  This was causing later addresses in a comma-separated
 string to disappear.

 Use memcpy instead of strcpy.  This could just cause Bad Things.

PR:		170832
MFC after:	1 week
This commit is contained in:
Jamie Gritton 2012-08-23 01:43:01 +00:00
parent b8ea11cf79
commit 2b4f1090de
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=239601

View File

@ -597,8 +597,7 @@ check_intparams(struct cfjail *j)
"ip4.addr: bad netmask \"%s\"", cs);
error = -1;
}
*cs = '\0';
s->len = cs - s->s + 1;
s->len = cs - s->s;
}
}
}
@ -621,8 +620,7 @@ check_intparams(struct cfjail *j)
cs);
error = -1;
}
*cs = '\0';
s->len = cs - s->s + 1;
s->len = cs - s->s;
}
}
}
@ -714,7 +712,7 @@ import_params(struct cfjail *j)
value = alloca(vallen);
cs = value;
TAILQ_FOREACH_SAFE(s, &p->val, tq, ts) {
strcpy(cs, s->s);
memcpy(cs, s->s, s->len);
if (ts != NULL) {
cs += s->len + 1;
cs[-1] = ',';