summaryrefslogtreecommitdiff
path: root/gweb/gweb.c
diff options
context:
space:
mode:
authorSamuel Ortiz <sameo@linux.intel.com>2011-04-01 16:59:44 +0200
committerSamuel Ortiz <sameo@linux.intel.com>2011-04-01 16:59:44 +0200
commit3053441f5c3338d7c4dc635ab268dc954ea77624 (patch)
tree57197d87399ebd745a2256abf69ff0f672b7c8d4 /gweb/gweb.c
parent262dcd410358c47099ff7015512e34626e0007d3 (diff)
downloadconnman-3053441f5c3338d7c4dc635ab268dc954ea77624.tar.gz
connman-3053441f5c3338d7c4dc635ab268dc954ea77624.tar.bz2
connman-3053441f5c3338d7c4dc635ab268dc954ea77624.zip
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
Diffstat (limited to 'gweb/gweb.c')
-rw-r--r--gweb/gweb.c5
1 files changed, 4 insertions, 1 deletions
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;