From 93af13ca1260732e3bfd8b9816db6223f4ff5e5b Mon Sep 17 00:00:00 2001 From: Viktor Dukhovni Date: Fri, 10 Apr 2015 02:21:35 +0000 Subject: [PATCH] Undo ntohs htons nesting to avoid variable shadowing --- lib/krb5/send_to_kdc.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/lib/krb5/send_to_kdc.c b/lib/krb5/send_to_kdc.c index 261b729c2..9daf55f65 100644 --- a/lib/krb5/send_to_kdc.c +++ b/lib/krb5/send_to_kdc.c @@ -789,6 +789,7 @@ submit_request(krb5_context context, krb5_sendto_ctx ctx, krb5_krbhst_info *hi) char *el, *proxy = proxy2; struct addrinfo hints; char portstr[NI_MAXSERV]; + unsigned short nport; if (proxy == NULL) return ENOMEM; @@ -809,8 +810,9 @@ submit_request(krb5_context context, krb5_sendto_ctx ctx, krb5_krbhst_info *hi) hints.ai_family = PF_UNSPEC; hints.ai_socktype = SOCK_STREAM; - snprintf(portstr, sizeof(portstr), "%d", - ntohs(init_port(el, htons(80)))); + /* On some systems ntohs(foo(..., htons(...))) causes shadowing */ + nport = init_port(el, htons(80)); + snprintf(portstr, sizeof(portstr), "%d", ntohs(nport)); ret = getaddrinfo(proxy, portstr, &hints, &ai); free(proxy2);