From d2a6532996ffc9e8d262ae4923a2c0c31d56ebb6 Mon Sep 17 00:00:00 2001 From: Ken Raeburn Date: Mon, 23 Aug 2004 20:31:31 +0000 Subject: [PATCH] * fake-addrinfo.h (fai_add_hosts_by_name): Handle case where returned ai_canonname is null git-svn-id: svn://anonsvn.mit.edu/krb5/trunk@16682 dc483132-0cff-0310-8789-dd5450dbe970 --- src/include/ChangeLog | 5 +++++ src/include/fake-addrinfo.h | 6 ++++-- 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/src/include/ChangeLog b/src/include/ChangeLog index f92a08ce8..495c4eca5 100644 --- a/src/include/ChangeLog +++ b/src/include/ChangeLog @@ -1,3 +1,8 @@ +2004-08-23 Ken Raeburn + + * fake-addrinfo.h (fai_add_hosts_by_name): Handle case where + returned ai_canonname is null. + 2004-08-14 Ken Raeburn * k5-thread.h (k5_os_nothread_mutex_assert_locked, diff --git a/src/include/fake-addrinfo.h b/src/include/fake-addrinfo.h index 8b9639365..2e11fefd1 100644 --- a/src/include/fake-addrinfo.h +++ b/src/include/fake-addrinfo.h @@ -787,7 +787,7 @@ static inline int fai_add_hosts_by_name (const char *name, break; } } - ce->canonname = strdup(ai->ai_canonname); + ce->canonname = ai->ai_canonname ? strdup(ai->ai_canonname) : 0; system_freeaddrinfo(ai); plant_face(name, ce); } @@ -810,7 +810,9 @@ static inline int fai_add_hosts_by_name (const char *name, } } if (*result && (flags & AI_CANONNAME)) - (*result)->ai_canonname = strdup(ce->canonname); + (*result)->ai_canonname = (ce->canonname + ? strdup(ce->canonname) + : NULL); krb5int_unlock_fac(); return 0; -- 2.26.2