From 3053441f5c3338d7c4dc635ab268dc954ea77624 Mon Sep 17 00:00:00 2001 From: Samuel Ortiz Date: Fri, 1 Apr 2011 16:59:44 +0200 Subject: gweb: Add port string to getaddrinfo Without doing so, the socket address returned will have its port field uninitialized. Fixes BMC#14753 Fixes BMC#15026 --- gweb/gweb.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'gweb') diff --git a/gweb/gweb.c b/gweb/gweb.c index 1bb1c700..75e64d96 100644 --- a/gweb/gweb.c +++ b/gweb/gweb.c @@ -1049,6 +1049,7 @@ static void resolv_result(GResolvResultStatus status, { struct web_session *session = user_data; struct addrinfo hints; + char *port; int ret; if (results == NULL || results[0] == NULL) { @@ -1066,7 +1067,9 @@ static void resolv_result(GResolvResultStatus status, session->addr = NULL; } - ret = getaddrinfo(results[0], NULL, &hints, &session->addr); + port = g_strdup_printf("%u", session->port); + ret = getaddrinfo(results[0], port, &hints, &session->addr); + g_free(port); if (ret != 0 || session->addr == NULL) { call_result_func(session, 400); return; -- cgit v1.2.3