summaryrefslogtreecommitdiffstats
path: root/usr.sbin/jail
diff options
context:
space:
mode:
authorjamie <jamie@FreeBSD.org>2012-08-23 01:43:01 +0000
committerjamie <jamie@FreeBSD.org>2012-08-23 01:43:01 +0000
commit2c0fa1424091a2dec98b12412d446a9cac3edc15 (patch)
tree18c8154ed7473c15c17dff79fd761c7e4a93573e /usr.sbin/jail
parent7d5d8d9c688deef00d97e644f678f1198076a8df (diff)
downloadFreeBSD-src-2c0fa1424091a2dec98b12412d446a9cac3edc15.zip
FreeBSD-src-2c0fa1424091a2dec98b12412d446a9cac3edc15.tar.gz
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
Diffstat (limited to 'usr.sbin/jail')
-rw-r--r--usr.sbin/jail/config.c8
1 files changed, 3 insertions, 5 deletions
diff --git a/usr.sbin/jail/config.c b/usr.sbin/jail/config.c
index 7a7917d..508f28b 100644
--- a/usr.sbin/jail/config.c
+++ b/usr.sbin/jail/config.c
@@ -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] = ',';
OpenPOWER on IntegriCloud