summaryrefslogtreecommitdiff
path: root/sbin
diff options
context:
space:
mode:
authorTheo de Raadt <deraadt@cvs.openbsd.org>2010-10-25 19:39:56 +0000
committerTheo de Raadt <deraadt@cvs.openbsd.org>2010-10-25 19:39:56 +0000
commitd539bcdfe39761e4307e30298b6dec05475521ef (patch)
treeb51d263dc762bfebb854f1c5c4f34a2495724f7f /sbin
parent336112b5b5e777eefc194a5f063f14fc2eae3976 (diff)
range check rtm_type more carefully against the known RTM_ values.
this is not the real solution to PR 6500; claudio is going to fix that properly in the kernel ok claudio
Diffstat (limited to 'sbin')
-rw-r--r--sbin/route/route.c11
1 files changed, 8 insertions, 3 deletions
diff --git a/sbin/route/route.c b/sbin/route/route.c
index 4e76e0a8892..f4a541ebde2 100644
--- a/sbin/route/route.c
+++ b/sbin/route/route.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: route.c,v 1.151 2010/10/11 11:45:00 claudio Exp $ */
+/* $OpenBSD: route.c,v 1.152 2010/10/25 19:39:55 deraadt Exp $ */
/* $NetBSD: route.c,v 1.16 1996/04/15 18:27:05 cgd Exp $ */
/*
@@ -1204,7 +1204,6 @@ char *msgtypes[] = {
"RTM_IFINFO: iface status change",
"RTM_IFANNOUNCE: iface arrival/departure",
"RTM_DESYNC: route socket overflow",
- NULL
};
char metricnames[] =
@@ -1247,7 +1246,13 @@ print_rtmsg(struct rt_msghdr *rtm, int msglen)
rtm->rtm_version);
return;
}
- printf("%s: len %d", msgtypes[rtm->rtm_type], rtm->rtm_msglen);
+ if (rtm->rtm_type > 0 &&
+ rtm->rtm_type < sizeof(msgtypes)/sizeof(msgtypes[0]))
+ printf("%s", msgtypes[rtm->rtm_type]);
+ else
+ printf("[rtm_type %d out of range]", rtm->rtm_type);
+
+ printf(": len %d", rtm->rtm_msglen);
switch (rtm->rtm_type) {
case RTM_DESYNC:
printf("\n");