From: Adam Dickmeiss Date: Thu, 19 Mar 2009 12:32:13 +0000 (+0100) Subject: Fix NULL ptr reference for HTTP proxy. X-Git-Tag: v1.1.0~34^2^2^2 X-Git-Url: http://git.indexdata.com/?a=commitdiff_plain;h=de765424c9aab4e0af9e4fd5bbf56296ec2998dc;p=pazpar2-moved-to-github.git Fix NULL ptr reference for HTTP proxy. The ser->host might be 0 in case attribute 'host' is not given for element 'listen' in configuration. This commit avoids referencing it in sprintf. --- diff --git a/src/http.c b/src/http.c index 86f8dc2..62233b2 100644 --- a/src/http.c +++ b/src/http.c @@ -794,7 +794,8 @@ static int http_proxy(struct http_request *rq) hp = http_header_append(c, hp, "X-Pazpar2-Server-Port", server_port); sprintf(server_via, "1.1 %s:%s (%s/%s)", - ser->host, server_port, PACKAGE_NAME, PACKAGE_VERSION); + ser->host ? ser->host : "@", + server_port, PACKAGE_NAME, PACKAGE_VERSION); hp = http_header_append(c, hp, "Via" , server_via); hp = http_header_append(c, hp, "X-Forwarded-For", c->addr); }