From 47a88e5dc91c523d4ffebf282f3bd26718c628f2 Mon Sep 17 00:00:00 2001 From: reyk Date: Fri, 18 Jul 2008 12:26:52 +0000 Subject: [PATCH] terminate the input buffer on failure in print_host() --- usr.sbin/relayd/log.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/usr.sbin/relayd/log.c b/usr.sbin/relayd/log.c index e9cd8cf202b..b5cf7e80cfc 100644 --- a/usr.sbin/relayd/log.c +++ b/usr.sbin/relayd/log.c @@ -1,4 +1,4 @@ -/* $OpenBSD: log.c,v 1.12 2008/07/17 15:10:14 reyk Exp $ */ +/* $OpenBSD: log.c,v 1.13 2008/07/18 12:26:52 reyk Exp $ */ /* * Copyright (c) 2003, 2004 Henning Brauer @@ -220,8 +220,10 @@ const char * print_host(struct sockaddr_storage *ss, char *buf, size_t len) { if (getnameinfo((struct sockaddr *)ss, ss->ss_len, - buf, len, NULL, 0, NI_NUMERICHOST) != 0) + buf, len, NULL, 0, NI_NUMERICHOST) != 0) { + buf[0] = '\0'; return (NULL); + } return (buf); } -- 2.20.1