From 5513fe0577a588f3efb35d621741e835539b474a Mon Sep 17 00:00:00 2001 From: Andy Green Date: Mon, 4 Jun 2012 08:53:26 +0800 Subject: [PATCH] add missing sa_data init to canonical hostname code Shay noticed we're no longer initializing the initial lookup of server canonical hostname correctly Reported-by: Shay Zuker Signed-off-by: Andy Green --- lib/libwebsockets.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/lib/libwebsockets.c b/lib/libwebsockets.c index 4c19a152..6f937788 100644 --- a/lib/libwebsockets.c +++ b/lib/libwebsockets.c @@ -2594,9 +2594,10 @@ libwebsocket_create_context(int port, const char *interf, n = 0; if (strlen(hostname) < sizeof(sa.sa_data) - 1) { + strcpy(sa.sa_data, hostname); // fprintf(stderr, "my host name is %s\n", sa.sa_data); - n = getnameinfo(&sa, sizeof(sa), hostname, (sizeof hostname) - 1, - NULL, 0, 0); + n = getnameinfo(&sa, sizeof(sa), hostname, + (sizeof hostname) - 1, NULL, 0, 0); } if (!n) {