diff options
author | Reyk Floeter <reyk@cvs.openbsd.org> | 2008-07-18 12:26:53 +0000 |
---|---|---|
committer | Reyk Floeter <reyk@cvs.openbsd.org> | 2008-07-18 12:26:53 +0000 |
commit | 736247fd945c4d85368d503fb285a9014f91e69e (patch) | |
tree | 4f3223ae59d93d6d53fc144e4584bf505bb36b21 | |
parent | 93ed39722d16e30be5952eaaf84b90543916ee06 (diff) |
terminate the input buffer on failure in print_host()
-rw-r--r-- | usr.sbin/relayd/log.c | 6 |
1 files 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 <henning@openbsd.org> @@ -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); } |