diff options
author | Reyk Floeter <reyk@cvs.openbsd.org> | 2007-02-26 16:10:25 +0000 |
---|---|---|
committer | Reyk Floeter <reyk@cvs.openbsd.org> | 2007-02-26 16:10:25 +0000 |
commit | 42b3f377da2203c5253a4fb26078c964ca074699 (patch) | |
tree | 19e0cfc14d8ea38ad8a07048bf5ac9952be058a0 /usr.sbin | |
parent | 71ade713505846cbd385c4554668951e2ffe732c (diff) |
handle strlcpy return values, make lint happy
Diffstat (limited to 'usr.sbin')
-rw-r--r-- | usr.sbin/hoststated/carp.c | 14 | ||||
-rw-r--r-- | usr.sbin/hoststated/hoststated.c | 4 | ||||
-rw-r--r-- | usr.sbin/hoststated/pfe.c | 4 | ||||
-rw-r--r-- | usr.sbin/hoststated/relay.c | 4 | ||||
-rw-r--r-- | usr.sbin/relayd/carp.c | 14 | ||||
-rw-r--r-- | usr.sbin/relayd/pfe.c | 4 | ||||
-rw-r--r-- | usr.sbin/relayd/relay.c | 4 | ||||
-rw-r--r-- | usr.sbin/relayd/relayd.c | 4 |
8 files changed, 34 insertions, 18 deletions
diff --git a/usr.sbin/hoststated/carp.c b/usr.sbin/hoststated/carp.c index cb97cbf32e3..6acdeb6efc7 100644 --- a/usr.sbin/hoststated/carp.c +++ b/usr.sbin/hoststated/carp.c @@ -1,4 +1,4 @@ -/* $OpenBSD: carp.c,v 1.2 2007/02/22 05:58:06 reyk Exp $ */ +/* $OpenBSD: carp.c,v 1.3 2007/02/26 16:10:24 reyk Exp $ */ /* * Copyright (c) 2006 Henning Brauer <henning@openbsd.org> @@ -114,7 +114,11 @@ carp_demote_get(char *group) } bzero(&ifgr, sizeof(ifgr)); - strlcpy(ifgr.ifgr_name, group, sizeof(ifgr.ifgr_name)); + if (strlcpy(ifgr.ifgr_name, group, sizeof(ifgr.ifgr_name)) >= + sizeof(ifgr.ifgr_name)) { + log_warn("carp_demote_get: invalid group"); + return (-1); + } if (ioctl(s, SIOCGIFGATTR, (caddr_t)&ifgr) == -1) { if (errno == ENOENT) @@ -193,7 +197,11 @@ carp_demote_ioctl(char *group, int demote) } bzero(&ifgr, sizeof(ifgr)); - strlcpy(ifgr.ifgr_name, group, sizeof(ifgr.ifgr_name)); + if (strlcpy(ifgr.ifgr_name, group, sizeof(ifgr.ifgr_name)) >= + sizeof(ifgr.ifgr_name)) { + log_warn("carp_demote_ioctl: invalid group"); + return (-1); + } ifgr.ifgr_attrib.ifg_carp_demoted = demote; if ((res = ioctl(s, SIOCSIFGATTR, (caddr_t)&ifgr)) == -1) diff --git a/usr.sbin/hoststated/hoststated.c b/usr.sbin/hoststated/hoststated.c index 22ba0ad6ed3..04deceefeda 100644 --- a/usr.sbin/hoststated/hoststated.c +++ b/usr.sbin/hoststated/hoststated.c @@ -1,4 +1,4 @@ -/* $OpenBSD: hoststated.c,v 1.19 2007/02/23 00:28:06 deraadt Exp $ */ +/* $OpenBSD: hoststated.c,v 1.20 2007/02/26 16:10:24 reyk Exp $ */ /* * Copyright (c) 2006 Pierre-Yves Ritschard <pyr@spootnik.org> @@ -607,7 +607,7 @@ expand_string(char *label, size_t len, const char *srch, const char *repl) log_debug("expand_string: string too long"); return (-1); } - strlcpy(label, tmp, len); /* always fits */ + (void)strlcpy(label, tmp, len); /* always fits */ free(tmp); return (0); diff --git a/usr.sbin/hoststated/pfe.c b/usr.sbin/hoststated/pfe.c index e267d2130b9..c3a3ba14b46 100644 --- a/usr.sbin/hoststated/pfe.c +++ b/usr.sbin/hoststated/pfe.c @@ -1,4 +1,4 @@ -/* $OpenBSD: pfe.c,v 1.17 2007/02/23 00:28:06 deraadt Exp $ */ +/* $OpenBSD: pfe.c,v 1.18 2007/02/26 16:10:24 reyk Exp $ */ /* * Copyright (c) 2006 Pierre-Yves Ritschard <pyr@spootnik.org> @@ -691,7 +691,7 @@ pfe_sync(void) continue; log_debug("pfe_sync: demote %d table '%s' group '%s'", demote.level, table->name, table->demote_group); - strlcpy(demote.group, table->demote_group, + (void)strlcpy(demote.group, table->demote_group, sizeof(demote.group)); imsg_compose(ibuf_main, IMSG_DEMOTE, 0, 0, &demote, sizeof(demote)); diff --git a/usr.sbin/hoststated/relay.c b/usr.sbin/hoststated/relay.c index 905bc11b32f..ee7926ba114 100644 --- a/usr.sbin/hoststated/relay.c +++ b/usr.sbin/hoststated/relay.c @@ -1,4 +1,4 @@ -/* $OpenBSD: relay.c,v 1.12 2007/02/26 15:41:44 reyk Exp $ */ +/* $OpenBSD: relay.c,v 1.13 2007/02/26 16:10:24 reyk Exp $ */ /* * Copyright (c) 2006, 2007 Reyk Floeter <reyk@openbsd.org> @@ -714,7 +714,7 @@ relay_expand_http(struct ctl_relay_event *cre, char *val, char *buf, size_t len) struct relay *rlay = (struct relay *)con->relay; char ibuf[128]; - strlcpy(buf, val, len); + (void)strlcpy(buf, val, len); if (strstr(val, "$REMOTE_") != NULL) { if (strstr(val, "$REMOTE_ADDR") != NULL) { diff --git a/usr.sbin/relayd/carp.c b/usr.sbin/relayd/carp.c index cb97cbf32e3..6acdeb6efc7 100644 --- a/usr.sbin/relayd/carp.c +++ b/usr.sbin/relayd/carp.c @@ -1,4 +1,4 @@ -/* $OpenBSD: carp.c,v 1.2 2007/02/22 05:58:06 reyk Exp $ */ +/* $OpenBSD: carp.c,v 1.3 2007/02/26 16:10:24 reyk Exp $ */ /* * Copyright (c) 2006 Henning Brauer <henning@openbsd.org> @@ -114,7 +114,11 @@ carp_demote_get(char *group) } bzero(&ifgr, sizeof(ifgr)); - strlcpy(ifgr.ifgr_name, group, sizeof(ifgr.ifgr_name)); + if (strlcpy(ifgr.ifgr_name, group, sizeof(ifgr.ifgr_name)) >= + sizeof(ifgr.ifgr_name)) { + log_warn("carp_demote_get: invalid group"); + return (-1); + } if (ioctl(s, SIOCGIFGATTR, (caddr_t)&ifgr) == -1) { if (errno == ENOENT) @@ -193,7 +197,11 @@ carp_demote_ioctl(char *group, int demote) } bzero(&ifgr, sizeof(ifgr)); - strlcpy(ifgr.ifgr_name, group, sizeof(ifgr.ifgr_name)); + if (strlcpy(ifgr.ifgr_name, group, sizeof(ifgr.ifgr_name)) >= + sizeof(ifgr.ifgr_name)) { + log_warn("carp_demote_ioctl: invalid group"); + return (-1); + } ifgr.ifgr_attrib.ifg_carp_demoted = demote; if ((res = ioctl(s, SIOCSIFGATTR, (caddr_t)&ifgr)) == -1) diff --git a/usr.sbin/relayd/pfe.c b/usr.sbin/relayd/pfe.c index e267d2130b9..c3a3ba14b46 100644 --- a/usr.sbin/relayd/pfe.c +++ b/usr.sbin/relayd/pfe.c @@ -1,4 +1,4 @@ -/* $OpenBSD: pfe.c,v 1.17 2007/02/23 00:28:06 deraadt Exp $ */ +/* $OpenBSD: pfe.c,v 1.18 2007/02/26 16:10:24 reyk Exp $ */ /* * Copyright (c) 2006 Pierre-Yves Ritschard <pyr@spootnik.org> @@ -691,7 +691,7 @@ pfe_sync(void) continue; log_debug("pfe_sync: demote %d table '%s' group '%s'", demote.level, table->name, table->demote_group); - strlcpy(demote.group, table->demote_group, + (void)strlcpy(demote.group, table->demote_group, sizeof(demote.group)); imsg_compose(ibuf_main, IMSG_DEMOTE, 0, 0, &demote, sizeof(demote)); diff --git a/usr.sbin/relayd/relay.c b/usr.sbin/relayd/relay.c index 905bc11b32f..ee7926ba114 100644 --- a/usr.sbin/relayd/relay.c +++ b/usr.sbin/relayd/relay.c @@ -1,4 +1,4 @@ -/* $OpenBSD: relay.c,v 1.12 2007/02/26 15:41:44 reyk Exp $ */ +/* $OpenBSD: relay.c,v 1.13 2007/02/26 16:10:24 reyk Exp $ */ /* * Copyright (c) 2006, 2007 Reyk Floeter <reyk@openbsd.org> @@ -714,7 +714,7 @@ relay_expand_http(struct ctl_relay_event *cre, char *val, char *buf, size_t len) struct relay *rlay = (struct relay *)con->relay; char ibuf[128]; - strlcpy(buf, val, len); + (void)strlcpy(buf, val, len); if (strstr(val, "$REMOTE_") != NULL) { if (strstr(val, "$REMOTE_ADDR") != NULL) { diff --git a/usr.sbin/relayd/relayd.c b/usr.sbin/relayd/relayd.c index 52755b0b646..f84b52eeb18 100644 --- a/usr.sbin/relayd/relayd.c +++ b/usr.sbin/relayd/relayd.c @@ -1,4 +1,4 @@ -/* $OpenBSD: relayd.c,v 1.19 2007/02/23 00:28:06 deraadt Exp $ */ +/* $OpenBSD: relayd.c,v 1.20 2007/02/26 16:10:24 reyk Exp $ */ /* * Copyright (c) 2006 Pierre-Yves Ritschard <pyr@spootnik.org> @@ -607,7 +607,7 @@ expand_string(char *label, size_t len, const char *srch, const char *repl) log_debug("expand_string: string too long"); return (-1); } - strlcpy(label, tmp, len); /* always fits */ + (void)strlcpy(label, tmp, len); /* always fits */ free(tmp); return (0); |