diff options
Diffstat (limited to 'usr.sbin/bgpd/util.c')
-rw-r--r-- | usr.sbin/bgpd/util.c | 15 |
1 files changed, 5 insertions, 10 deletions
diff --git a/usr.sbin/bgpd/util.c b/usr.sbin/bgpd/util.c index 854adc4dc6b..3ae38bcc1cc 100644 --- a/usr.sbin/bgpd/util.c +++ b/usr.sbin/bgpd/util.c @@ -1,4 +1,4 @@ -/* $OpenBSD: util.c,v 1.17 2013/10/30 17:28:33 deraadt Exp $ */ +/* $OpenBSD: util.c,v 1.18 2014/11/11 07:15:33 phessler Exp $ */ /* * Copyright (c) 2006 Claudio Jeker <claudio@openbsd.org> @@ -92,16 +92,11 @@ log_sockaddr(struct sockaddr *sa) const char * log_as(u_int32_t as) { - static char buf[12]; /* "65000.65000\0" */ + static char buf[11]; /* "4294967294\0" */ + + if (snprintf(buf, sizeof(buf), "%u", as) == -1) + return ("?"); - if (as <= USHRT_MAX) { - if (snprintf(buf, sizeof(buf), "%u", as) == -1) - return ("?"); - } else { - if (snprintf(buf, sizeof(buf), "%u.%u", as >> 16, - as & 0xffff) == -1) - return ("?"); - } return (buf); } |