summaryrefslogtreecommitdiff
path: root/sys/net
diff options
context:
space:
mode:
authorTheo de Raadt <deraadt@cvs.openbsd.org>2008-01-05 07:26:05 +0000
committerTheo de Raadt <deraadt@cvs.openbsd.org>2008-01-05 07:26:05 +0000
commit3a2908a75fada918b05a0df4465e6b49314beb80 (patch)
tree34c522d34788af14990f3f127cf627458e1ee5fa /sys/net
parent71e014c4aff529a13dd715edf406dc7434135d0e (diff)
rtlabel_id2name() can return NULL if there is no route label..
from chris@nmedia.net
Diffstat (limited to 'sys/net')
-rw-r--r--sys/net/if.c13
1 files changed, 8 insertions, 5 deletions
diff --git a/sys/net/if.c b/sys/net/if.c
index 9a425dc2f22..7068202e0d7 100644
--- a/sys/net/if.c
+++ b/sys/net/if.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: if.c,v 1.166 2007/09/15 16:43:51 henning Exp $ */
+/* $OpenBSD: if.c,v 1.167 2008/01/05 07:26:04 deraadt Exp $ */
/* $NetBSD: if.c,v 1.35 1996/05/07 05:26:04 thorpej Exp $ */
/*
@@ -1290,10 +1290,13 @@ ifioctl(struct socket *so, u_long cmd, caddr_t data, struct proc *p)
break;
case SIOCGIFRTLABEL:
- label = rtlabel_id2name(ifp->if_rtlabelid);
- strlcpy(ifrtlabelbuf, label, RTLABEL_LEN);
- error = copyoutstr(ifrtlabelbuf, ifr->ifr_data, RTLABEL_LEN,
- &bytesdone);
+ if (ifp->if_rtlabelid) {
+ label = rtlabel_id2name(ifp->if_rtlabelid);
+ strlcpy(ifrtlabelbuf, label, RTLABEL_LEN);
+ error = copyoutstr(ifrtlabelbuf, ifr->ifr_data,
+ RTLABEL_LEN, &bytesdone);
+ } else
+ error = ENOENT;
break;
case SIOCSIFRTLABEL: