commit - 22b973e10b6aaf19408e3ced15c5b7594d3db34e
commit + b4a50969aae71604f0b273ee30112bfeafe407e5
blob - 22a2e411f40c066e961c8c972579b1b260cb9994
blob + 5e584a560d3aac3d61171c7e440552b7cd5dad6f
--- thingsctl/parser.c
+++ thingsctl/parser.c
match_token(const char *word, const struct token *table,
struct parse_result *res)
{
- size_t n;
u_int i, match;
const struct token *t = NULL;
if (!match && word != NULL && strlen(word) > 0) {
memset(res->name, 0,
sizeof(res->name));
- n = strlcpy(res->name, word,
- sizeof(res->name));
- if (n >= sizeof(res->name))
- err(1, "name too long");
+ memcpy(&res->name, word, sizeof(res->name));
match++;
t = &table[i];
if (t->value)
blob - 08dafa564235a5e1db17d256e3173a0cab02aff1
blob + 0b0d17cb584882cf34a2457c3e97546716b1f1dd
--- thingsctl/thingsctl.c
+++ thingsctl/thingsctl.c
memset(&sun, 0, sizeof(sun));
sun.sun_family = AF_UNIX;
- strlcpy(sun.sun_path, sockname, sizeof(sun.sun_path));
+ memcpy(&sun.sun_path, sockname, sizeof(sun.sun_path));
if (connect(ctl_sock, (struct sockaddr *)&sun, sizeof(sun)) == -1)
err(1, "connect: %s", sockname);
blob - 87f051e1ac40fe3d0fe2e42309f89851765c3044
blob + 3a5af70f06da6d9221f1d75e6386da8568d2a8b1
--- thingsd/client.c
+++ thingsd/client.c
{
char filter[THINGSD_MAXNAME];
struct client *client, nci;
- size_t n;
switch (imsg->hdr.type) {
case IMSG_GET_INFO_CLIENTS_REQUEST:
if (filter[0] == '\0' || memcmp(filter,
client->name, sizeof(filter)) == 0) {
- n = strlcpy(nci.name, client->name,
+ memcpy(&nci.name, client->name,
sizeof(nci.name));
- if (n >= sizeof(nci.name))
- fatalx("%s: nci.name too long",
- __func__);
nci.subscribed = client->subscribed;
nci.fd = client->fd;
blob - 5f0af946bd2fdad35d259d3ac38567b1dba5c254
blob + 9d98aede1721a3938abbb8d79c3928d8327cb68e
--- thingsd/control.c
+++ thingsd/control.c
}
sun.sun_family = AF_UNIX;
- if (strlcpy(sun.sun_path, cs->cs_name,
- sizeof(sun.sun_path)) >= sizeof(sun.sun_path)) {
- log_warn("%s: %s name too long", __func__, cs->cs_name);
- close(fd);
- return (-1);
- }
+ memcpy(&sun.sun_path, cs->cs_name, sizeof(sun.sun_path));
if (unlink(cs->cs_name) == -1)
if (errno != ENOENT) {
blob - a5d75fc22aba5c3c780bfdc5a673925b416cb39e
blob + 8958a4552140b6c9e7791f518c326da9a024d3ac
--- thingsd/parse.y
+++ thingsd/parse.y
struct client *client, *tclient;
char my_name[THINGSD_MAXTEXT];
int my_fd, pkt_len;
-size_t pn;
struct thing *conf_new_thing(char *);
;
bindopts1 : BIND INTERFACE STRING {
- pn = strlcpy(thingsd_env->iface, $3,
+ memcpy(&thingsd_env->iface, $3,
sizeof(thingsd_env->iface));
- if (pn >= sizeof(thingsd_env->iface))
- fatalx("%s: thingsd_env->iface too long",
- __func__);
free($3);
}
;
bindopts2 : BIND INTERFACE STRING {
- pn = strlcpy(new_thing->iface, $3,
+ memcpy(&new_thing->iface, $3,
sizeof(new_thing->iface));
- if (pn >= sizeof(new_thing->iface))
- fatalx("%s: new_thing->iface too long",
- __func__);
free($3);
}
;
}
| maxclientssub
| PASSWORD STRING {
- pn = strlcpy(new_thing->password, $2,
+ memcpy(&new_thing->password, $2,
sizeof(new_thing->password));
- if (pn >= sizeof(new_thing->password))
- fatalx("%s: new_thing->password too long",
- __func__);
free($2);
}
| PARITY STRING {
for (pc = 0; pc < parities; pc++) {
if (strcmp($2, parity[pc]) == 0) {
- pn = strlcpy(new_thing->parity, $2,
+ memcpy(&new_thing->parity, $2,
sizeof(new_thing->parity));
- if (pn >= sizeof(new_thing->parity))
- fatalx("%s: new_thing->parity "
- "too long", __func__);
continue;
}
}
TAILQ_FOREACH(client, thingsd_env->clients, entry) {
if (client == tclient) {
memset(&my_name, 0, sizeof(my_name));
- pn = strlcpy(client->name, $3,
+ memcpy(&client->name, $3,
sizeof(client->name));
- if (pn >= sizeof(client->name))
- fatalx("%s: client->name too "
- "long", __func__);
- pn = strlcpy(my_name, $3,
- sizeof(my_name));
- if (pn >= sizeof(my_name))
- fatalx("%s: my_name too long ",
- __func__);
+ memcpy(&my_name, $3, sizeof(my_name));
break;
}
}
new_thing->rcv_port = $4;
}
| PASSWORD STRING {
- pn = strlcpy(new_thing->password, $2,
+ memcpy(&new_thing->password, $2,
sizeof(new_thing->password));
- if (pn >= sizeof(new_thing->password))
- fatalx("%s: new_thing->password too long",
- __func__);
free($2);
}
| PERSISTENT NUMBER {
new_thing = conf_new_thing($2);
if (strlen(thingsd_env->iface) != 0) {
- pn = strlcpy(new_thing->iface,
- thingsd_env->iface, sizeof(new_thing->iface));
- if (pn >= sizeof(new_thing->iface))
- fatalx("%s: new_thing->iface too long",
- __func__);
+ memcpy(&new_thing->iface, thingsd_env->iface,
+ sizeof(new_thing->iface));
} else
memset(new_thing->iface, 0,
sizeof(new_thing->iface));
memset(new_thing->tls_cert_file, 0,
sizeof(new_thing->tls_cert_file));
- pn = strlcpy(new_thing->tls_cert_file, TLS_CERT,
+ memcpy(&new_thing->tls_cert_file, TLS_CERT,
sizeof(new_thing->tls_cert_file));
- if (pn >= sizeof(new_thing->tls_cert_file))
- fatalx("%s: new_thing->tls_cert_file too long",
- __func__);
memset(new_thing->tls_key_file, 0,
sizeof(new_thing->tls_key_file));
- pn = strlcpy(new_thing->tls_key_file, TLS_KEY,
+ memcpy(&new_thing->tls_key_file, TLS_KEY,
sizeof(new_thing->tls_key_file));
- if (pn >= sizeof(new_thing->tls_key_file))
- fatalx("%s: new_thing->tls_key_file too long",
- __func__);
- pn = strlcpy(new_thing->tls_ciphers, TLS_CIPHERS,
+ memcpy(&new_thing->tls_ciphers, TLS_CIPHERS,
sizeof(new_thing->tls_ciphers));
- if (pn >= sizeof(new_thing->tls_ciphers))
- fatalx("thing strlcpy");
- pn = strlcpy(new_thing->tls_dhe_params, TLS_DHE_PARAMS,
+ memcpy(&new_thing->tls_dhe_params, TLS_DHE_PARAMS,
sizeof(new_thing->tls_dhe_params));
- if (pn >= sizeof(new_thing->tls_dhe_params))
- fatalx("thing strlcpy");
- pn = strlcpy(new_thing->tls_ecdhe_curves,
+ memcpy(&new_thing->tls_ecdhe_curves,
TLS_ECDHE_CURVES,
sizeof(new_thing->tls_ecdhe_curves));
- if (pn >= sizeof(new_thing->tls_ecdhe_curves))
- fatalx("thing strlcpy");
free($2);
} '{' optnl thingopts2 '}' {
if (strlen(new_thing->ipaddr) != 0 &&
yyerror("ipaddr string empty");
YYERROR;
}
- pn = strlcpy(new_thing->ipaddr, $2,
+ memcpy(&new_thing->ipaddr, $2,
sizeof(new_thing->ipaddr));
- if (pn >= sizeof(new_thing->ipaddr))
- fatalx("%s: new_thing->ipaddr too long",
- __func__);
free($2);
} '{' optnl socketopts2 '}'
| LOCATION STRING {
- pn = strlcpy(new_thing->location, $2,
+ memcpy(&new_thing->location, $2,
sizeof(new_thing->location));
- if (pn >= sizeof(new_thing->location))
- fatalx("%s: new_thing->location too long",
- __func__);
free($2);
} locationopts
| UDP STRING {
- pn = strlcpy(new_thing->udp, $2,
- sizeof(new_thing->udp));
- if (pn >= sizeof(new_thing->udp))
- fatalx("%s: new_thing->udp too long",
- __func__);
+ memcpy(&new_thing->udp, $2, sizeof(new_thing->udp));
free($2);
} '{' optnl socketopts2 '}'
;
tlscltopt : /* empty */
| tlscltopt CRL STRING {
new_thing->tls_flags = TLSFLAG_CRL;
- pn = strlcpy(new_thing->tls_crl_file, $3,
+ memcpy(&new_thing->tls_crl_file, $3,
sizeof(new_thing->tls_crl_file));
- if (pn >= sizeof(new_thing->tls_crl_file))
- fatalx("%s: new_thing->tls_crl_file too long",
- __func__);
free($3);
}
| tlscltopt OPTIONAL {
;
tlsopts : CERTIFICATE STRING {
- pn = strlcpy(new_thing->tls_cert_file, $2,
+ memcpy(&new_thing->tls_cert_file, $2,
sizeof(new_thing->tls_cert_file));
- if (pn >= sizeof(new_thing->tls_cert_file))
- fatalx("%s: new_thing->tls_cert_file too long",
- __func__);
free($2);
}
| CIPHERS STRING {
- if (strlcpy(new_thing->tls_ciphers, $2,
- sizeof(new_thing->tls_ciphers)) >=
- sizeof(new_thing->tls_ciphers)) {
- yyerror("ciphers too long");
- free($2);
- YYERROR;
- }
+ memcpy(&new_thing->tls_ciphers, $2,
+ sizeof(new_thing->tls_ciphers));
free($2);
}
| CLIENT CA STRING tlscltopt {
new_thing->tls_flags |= TLSFLAG_CA;
- pn = strlcpy(new_thing->tls_ca_file, $3,
+ memcpy(&new_thing->tls_ca_file, $3,
sizeof(new_thing->tls_ca_file));
- if (pn >= sizeof(new_thing->tls_ca_file))
- fatalx("%s: new_thing->tls_ca_file too long",
- __func__);
free($3);
}
| DHE STRING {
- if (strlcpy(new_thing->tls_dhe_params, $2,
- sizeof(new_thing->tls_dhe_params)) >=
- sizeof(new_thing->tls_dhe_params)) {
- yyerror("dhe too long");
- free($2);
- YYERROR;
- }
+ memcpy(&new_thing->tls_dhe_params, $2,
+ sizeof(new_thing->tls_dhe_params));
free($2);
}
| ECDHE STRING {
- if (strlcpy(new_thing->tls_ecdhe_curves, $2,
- sizeof(new_thing->tls_ecdhe_curves)) >=
- sizeof(new_thing->tls_ecdhe_curves)) {
- yyerror("ecdhe too long");
- free($2);
- YYERROR;
- }
+ memcpy(&new_thing->tls_ecdhe_curves, $2,
+ sizeof(new_thing->tls_ecdhe_curves));
free($2);
}
| KEY STRING {
- pn = strlcpy(new_thing->tls_key_file, $2,
+ memcpy(&new_thing->tls_key_file, $2,
sizeof(new_thing->tls_key_file));
- if (pn >= sizeof(new_thing->tls_key_file))
- fatalx("%s: new_thing->tls_key_file too long",
- __func__);
free($2);
}
| OCSP STRING {
- pn = strlcpy(new_thing->tls_ocsp_staple_file, $2,
+ memcpy(&new_thing->tls_ocsp_staple_file, $2,
sizeof(new_thing->tls_ocsp_staple_file));
- if (pn >= sizeof(new_thing->tls_ocsp_staple_file))
- fatalx("%s: new_thing->tls_ocsp_staple_file "
- "too long", __func__);
free($2);
}
| PROTOCOLS STRING {
if (sym == NULL)
fatal("%s: malloc", __func__);
- strlcpy(sym, s, len);
+ memcpy(&sym, s, len);
ret = symset(sym, val + 1, 1);
free(sym);
new_sub(char *name)
{
struct subscription *sub;
- size_t n;
sub = calloc(1, sizeof(*sub));
if (sub == NULL)
fatal("%s: calloc", __func__);
memset(&sub->thing_name, 0, sizeof(sub->thing_name));
- n = strlcpy(sub->thing_name, name, sizeof(sub->thing_name));
- if (n >= sizeof(sub->thing_name))
- fatalx("%s: sub->thing_name too long", __func__);
+ memcpy(&sub->thing_name, name, sizeof(sub->thing_name));
return (sub);
}
conf_new_thing(char *name)
{
struct thing *thing;
- size_t n;
TAILQ_FOREACH(thing, thingsd_env->things, entry) {
if (strcmp(name, thing->name) == 0)
thing = calloc(1, sizeof(*thing));
if (thing == NULL)
fatal("%s: calloc", __func__);
- n = strlcpy(thing->name, name, sizeof(thing->name));
- if (n >= sizeof(thing->name))
- fatalx("%s: thing->name too long", __func__);
+ memcpy(&thing->name, name, sizeof(thing->name));
TAILQ_INSERT_TAIL(thingsd_env->things, thing, entry);
blob - 36628df5556dd5edae78dff6866e32d8c0862d27
blob + 4ff814057a5a25d9f2f569d5b51764496b65b948
--- thingsd/sockets.c
+++ thingsd/sockets.c
bool fail = false;
evbuffercb socketrd = socket_rd;
evbuffercb socketwr = socket_wr;
- size_t n;
TAILQ_FOREACH(thing, env->things, entry) {
if (reconn) {
sock->max_clients += thing->max_clients;
- n = strlcpy(sock->name, thing->name, sizeof(sock->name));
- if (n >= sizeof(sock->name))
- fatalx("%s: sock->name too long", __func__);
+ memcpy(&sock->name, thing->name, sizeof(sock->name));
if (strlen(thing->iface) != 0)
iface = get_ifaddrs(thing->iface);
}
}
+ free(iface);
}
int
{
char filter[THINGSD_MAXNAME];
struct socket *socket, nsi;
- size_t n;
switch (imsg->hdr.type) {
case IMSG_GET_INFO_SOCKETS_REQUEST:
if (filter[0] == '\0' || memcmp(filter,
socket->name, sizeof(filter)) == 0) {
- n = strlcpy(nsi.name, socket->name,
+ memcpy(&nsi.name, socket->name,
sizeof(nsi.name));
- if (n >= sizeof(nsi.name))
- fatalx("%s: nsi.name too long",
- __func__);
nsi.fd = socket->fd;
nsi.port = socket->port;
blob - 5cf3b4bd8a5c88ab5b676ce8653427b23f705dec
blob + fe7f6d3506c7a8a034367139268f2c0011cd4517
--- thingsd/things.c
+++ thingsd/things.c
struct thing *thing, nti;
int res = 0, cmd = 0, verbose;
unsigned int mode;
- size_t n;
switch (imsg->hdr.type) {
case IMSG_ADD_THING:
thing->hw_ctl = nti.hw_ctl;
thing->persist = nti.persist;
- n = strlcpy(thing->iface, nti.iface, sizeof(thing->iface));
- if (n >= sizeof(thing->iface))
- fatalx("%s: thing->iface too long", __func__);
+ memcpy(&thing->iface, nti.iface, sizeof(thing->iface));
- n = strlcpy(thing->ipaddr, nti.ipaddr, sizeof(thing->ipaddr));
- if (n >= sizeof(thing->ipaddr))
- fatalx("%s: thing->ipaddr too long", __func__);
+ memcpy(&thing->ipaddr, nti.ipaddr, sizeof(thing->ipaddr));
- n = strlcpy(thing->parity, nti.parity, sizeof(thing->parity));
- if (n >= sizeof(thing->parity))
- fatalx("%s: thing->parity name too long", __func__);
+ memcpy(&thing->parity, nti.parity, sizeof(thing->parity));
- n = strlcpy(thing->name, nti.name, sizeof(thing->name));
- if (n >= sizeof(thing->name))
- fatalx("%s: thing->name too long", __func__);
+ memcpy(&thing->name, nti.name, sizeof(thing->name));
- n = strlcpy(thing->password, nti.password,
+ memcpy(&thing->password, nti.password,
sizeof(thing->password));
- if (n >= sizeof(thing->password))
- fatalx("%s: thing->password too long", __func__);
- n = strlcpy(thing->location, nti.location,
+ memcpy(&thing->location, nti.location,
sizeof(thing->location));
- if (n >= sizeof(thing->location))
- fatalx("%s: thing->location too long", __func__);
- n = strlcpy(thing->udp, nti.udp, sizeof(thing->udp));
- if (n >= sizeof(thing->udp))
- fatalx("%s: thing->name too long", __func__);
+ memcpy(&thing->udp, nti.udp, sizeof(thing->udp));
thing->fd = nti.fd;
thing->baud = nti.baud;
thing->client_cnt = nti.client_cnt;
thing->tls = nti.tls;
- n = strlcpy(thing->tls_cert_file, nti.tls_cert_file,
+ memcpy(&thing->tls_cert_file, nti.tls_cert_file,
sizeof(thing->tls_cert_file));
- if (n >= sizeof(thing->tls_cert_file))
- fatalx("%s: thing->tls_cert_file too long", __func__);
- n = strlcpy(thing->tls_key_file, nti.tls_key_file,
+ memcpy(&thing->tls_key_file, nti.tls_key_file,
sizeof(thing->tls_key_file));
- if (n >= sizeof(thing->tls_key_file))
- fatalx("%s: thing->tls_key_file too long", __func__);
- n = strlcpy(thing->tls_ca_file, nti.tls_ca_file,
+ memcpy(&thing->tls_ca_file, nti.tls_ca_file,
sizeof(thing->tls_ca_file));
- if (n >= sizeof(thing->tls_ca_file))
- fatalx("%s: thing->tls_ca_file too long", __func__);
- n = strlcpy(thing->tls_crl_file, nti.tls_crl_file,
+ memcpy(&thing->tls_crl_file, nti.tls_crl_file,
sizeof(thing->tls_crl_file));
- if (n >= sizeof(thing->tls_crl_file))
- fatalx("%s: thing->tls_crl_file too long", __func__);
- n = strlcpy(thing->tls_ocsp_staple_file,
+ memcpy(&thing->tls_ocsp_staple_file,
nti.tls_ocsp_staple_file,
sizeof(thing->tls_ocsp_staple_file));
- if (n >= sizeof(thing->tls_ocsp_staple_file))
- fatalx("%s: thing->tls_ocsp_staple_file too long",
- __func__);
TAILQ_INSERT_TAIL(thingsd_env->things, thing, entry);
{
struct thing nti;
char blank[9] = "********";
- size_t n;
memset(&nti, 0, sizeof(nti));
nti.exists = thing->exists;
nti.hw_ctl = thing->hw_ctl;
nti.persist = thing->persist;
- n = strlcpy(nti.iface, thing->iface, sizeof(nti.iface));
- if (n >= sizeof(nti.iface))
- fatalx("%s: nti.iface too long", __func__);
+ memcpy(&nti.iface, thing->iface, sizeof(nti.iface));
- n = strlcpy(nti.ipaddr, thing->ipaddr, sizeof(nti.ipaddr));
- if (n >= sizeof(nti.ipaddr))
- fatalx("%s: nti.ipaddr too long", __func__);
+ memcpy(&nti.ipaddr, thing->ipaddr, sizeof(nti.ipaddr));
- n = strlcpy(nti.parity, thing->parity, sizeof(nti.parity));
- if (n >= sizeof(nti.parity))
- fatalx("%s: nti.parity too long", __func__);
+ memcpy(&nti.parity, thing->parity, sizeof(nti.parity));
- n = strlcpy(nti.name, thing->name, sizeof(nti.name));
- if (n >= sizeof(nti.name))
- fatalx("%s: nti.name too long", __func__);
+ memcpy(&nti.name, thing->name, sizeof(nti.name));
nti.password[0] = '\0';
if (type == IMSG_GET_INFO_THINGS_REQUEST)
- n = strlcpy(nti.password, blank, sizeof(nti.password));
+ memcpy(&nti.password, blank, sizeof(nti.password));
else
- n = strlcpy(nti.password, thing->password,
+ memcpy(&nti.password, thing->password,
sizeof(nti.password));
- if (n >= sizeof(nti.password))
- fatalx("%s: nti.password too long", __func__);
- n = strlcpy(nti.location, thing->location, sizeof(nti.location));
- if (n >= sizeof(nti.location))
- fatalx("%s: nti.location too long", __func__);
+ memcpy(&nti.location, thing->location, sizeof(nti.location));
- n = strlcpy(nti.udp, thing->udp, sizeof(nti.udp));
- if (n >= sizeof(nti.udp))
- fatalx("%s: nti.udp too long", __func__);
+ memcpy(&nti.udp, thing->udp, sizeof(nti.udp));
nti.fd = thing->fd;
nti.baud = thing->baud;
nti.client_cnt = thing->client_cnt;
nti.tls = thing->tls;
- n = strlcpy(nti.tls_cert_file, thing->tls_cert_file,
+ memcpy(&nti.tls_cert_file, thing->tls_cert_file,
sizeof(nti.tls_cert_file));
- if (n >= sizeof(nti.tls_cert_file))
- fatalx("%s: nti.tls_cert_file too long", __func__);
- n = strlcpy(nti.tls_key_file, thing->tls_key_file,
+ memcpy(&nti.tls_key_file, thing->tls_key_file,
sizeof(nti.tls_key_file));
- if (n >= sizeof(nti.tls_key_file))
- fatalx("%s: nti.tls_key_file too long", __func__);
- n = strlcpy(nti.tls_ca_file, thing->tls_ca_file,
+ memcpy(&nti.tls_ca_file, thing->tls_ca_file,
sizeof(nti.tls_ca_file));
- if (n >= sizeof(nti.tls_ca_file))
- fatalx("%s: nti.tls_ca_file too long", __func__);
- n = strlcpy(nti.tls_crl_file, thing->tls_crl_file,
+ memcpy(&nti.tls_crl_file, thing->tls_crl_file,
sizeof(nti.tls_crl_file));
- if (n >= sizeof(nti.tls_crl_file))
- fatalx("%s: nti.tls_crl_file too long", __func__);
- n = strlcpy(nti.tls_ocsp_staple_file, thing->tls_ocsp_staple_file,
+ memcpy(&nti.tls_ocsp_staple_file, thing->tls_ocsp_staple_file,
sizeof(nti.tls_ocsp_staple_file));
- if (n >= sizeof(nti.tls_ocsp_staple_file))
- fatalx("%s: nti.tls_ocsp_staple_file too long", __func__);
return nti;
}
*new_dead_thing(struct thing *thing)
{
struct dead_thing *dead_thing;
- size_t n;
dead_thing = calloc(1, sizeof(*dead_thing));
if (dead_thing == NULL)
log_debug("%s: adding detached thing, %s", __func__, thing->name);
- n = strlcpy(dead_thing->name, thing->name, sizeof(dead_thing->name));
- if (n >= sizeof(dead_thing->name))
- fatalx("%s: dead_thing->name too long", __func__);
+ memcpy(&dead_thing->name, thing->name, sizeof(dead_thing->name));
dead_thing->type = thing->type;
dead_thing->dtime = time(NULL);
blob - ea9b40bf2f9f2bea439ce1701818c3f638cef42e
blob + ebcf62cc1f2f9008f824ac295a61fdb1d6999112
--- thingsd/thingsd.c
+++ thingsd/thingsd.c
thingsd_configure_things(struct privsep *ps)
{
struct thing *thing, nti;
- size_t n;
open_things(thingsd_env, false);
create_sockets(thingsd_env, false);
nti.hw_ctl = thing->hw_ctl;
nti.persist = thing->persist;
- n = strlcpy(nti.iface, thing->iface, sizeof(nti.iface));
- if (n >= sizeof(nti.iface))
- fatalx("%s: nti.iface too long", __func__);
+ memcpy(&nti.iface, thing->iface, sizeof(nti.iface));
- n = strlcpy(nti.ipaddr, thing->ipaddr, sizeof(nti.ipaddr));
- if (n >= sizeof(nti.ipaddr))
- fatalx("%s: nti.ipaddr too long", __func__);
+ memcpy(&nti.ipaddr, thing->ipaddr, sizeof(nti.ipaddr));
- n = strlcpy(nti.parity, thing->parity, sizeof(nti.parity));
- if (n >= sizeof(nti.parity))
- fatalx("%s: nti.parity name too long", __func__);
+ memcpy(&nti.parity, thing->parity, sizeof(nti.parity));
- n = strlcpy(nti.name, thing->name, sizeof(nti.name));
- if (n >= sizeof(nti.name))
- fatalx("%s: nti.name too long", __func__);
+ memcpy(&nti.name, thing->name, sizeof(nti.name));
- n = strlcpy(nti.password, thing->password,
+ memcpy(&nti.password, thing->password,
sizeof(nti.password));
- if (n >= sizeof(nti.password))
- fatalx("%s: nti.password too long", __func__);
- n = strlcpy(nti.location, thing->location,
+ memcpy(&nti.location, thing->location,
sizeof(nti.location));
- if (n >= sizeof(nti.location))
- fatalx("%s: nti.location too long", __func__);
- n = strlcpy(nti.udp, thing->udp, sizeof(nti.udp));
- if (n >= sizeof(nti.udp))
- fatalx("%s: nti.name too long", __func__);
+ memcpy(&nti.udp, thing->udp, sizeof(nti.udp));
nti.fd = thing->fd;
nti.baud = thing->baud;
nti.tls = thing->tls;
- n = strlcpy(nti.tls_cert_file, thing->tls_cert_file,
+ memcpy(&nti.tls_cert_file, thing->tls_cert_file,
sizeof(nti.tls_cert_file));
- if (n >= sizeof(nti.tls_cert_file))
- fatalx("%s: nti.tls_cert_file too long", __func__);
- n = strlcpy(nti.tls_key_file, thing->tls_key_file,
+ memcpy(&nti.tls_key_file, thing->tls_key_file,
sizeof(nti.tls_key_file));
- if (n >= sizeof(nti.tls_key_file))
- fatalx("%s: nti.tls_key_file too long", __func__);
- n = strlcpy(nti.tls_ca_file, thing->tls_ca_file,
+ memcpy(&nti.tls_ca_file, thing->tls_ca_file,
sizeof(nti.tls_ca_file));
- if (n >= sizeof(nti.tls_ca_file))
- fatalx("%s: nti.tls_ca_file too long", __func__);
- n = strlcpy(nti.tls_crl_file, thing->tls_crl_file,
+ memcpy(&nti.tls_crl_file, thing->tls_crl_file,
sizeof(nti.tls_crl_file));
- if (n >= sizeof(nti.tls_crl_file))
- fatalx("%s: nti.tls_crl_file too long", __func__);
- n = strlcpy(nti.tls_ocsp_staple_file,
+ memcpy(&nti.tls_ocsp_staple_file,
thing->tls_ocsp_staple_file,
sizeof(nti.tls_ocsp_staple_file));
- if (n >= sizeof(nti.tls_ocsp_staple_file))
- fatalx("%s: nti.tls_ocsp_staple_file too long",
- __func__);
proc_compose(ps, PROC_THINGS, IMSG_ADD_THING,
&nti, sizeof(nti));