Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/libexec/tftpd handle getnameinfo error properly



details:   https://anonhg.NetBSD.org/src/rev/0193ae81ab78
branches:  trunk
changeset: 499513:0193ae81ab78
user:      itojun <itojun%NetBSD.org@localhost>
date:      Tue Nov 21 13:39:07 2000 +0000

description:
handle getnameinfo error properly

diffstat:

 libexec/tftpd/tftpd.c |  7 ++++---
 1 files changed, 4 insertions(+), 3 deletions(-)

diffs (27 lines):

diff -r c335b2a2e943 -r 0193ae81ab78 libexec/tftpd/tftpd.c
--- a/libexec/tftpd/tftpd.c     Tue Nov 21 13:34:57 2000 +0000
+++ b/libexec/tftpd/tftpd.c     Tue Nov 21 13:39:07 2000 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: tftpd.c,v 1.19 2000/10/18 01:35:46 dogcow Exp $        */
+/*     $NetBSD: tftpd.c,v 1.20 2000/11/21 13:39:07 itojun Exp $        */
 
 /*
  * Copyright (c) 1983, 1993
@@ -40,7 +40,7 @@
 #if 0
 static char sccsid[] = "@(#)tftpd.c    8.1 (Berkeley) 6/4/93";
 #else
-__RCSID("$NetBSD: tftpd.c,v 1.19 2000/10/18 01:35:46 dogcow Exp $");
+__RCSID("$NetBSD: tftpd.c,v 1.20 2000/11/21 13:39:07 itojun Exp $");
 #endif
 #endif /* not lint */
 
@@ -800,6 +800,7 @@
 {
        static char hbuf[MAXHOSTNAMELEN];
 
-       getnameinfo(fromp, fromp->sa_len, hbuf, sizeof(hbuf), NULL, 0, 0);
+       if (getnameinfo(fromp, fromp->sa_len, hbuf, sizeof(hbuf), NULL, 0, 0))
+               strlcpy(hbuf, "?", sizeof(hbuf));
        return hbuf;
 }



Home | Main Index | Thread Index | Old Index