From 0dc4801791d956c3d4d2059b6fcdd249fe152df5 Mon Sep 17 00:00:00 2001 From: Holger Weiss Date: Fri, 15 Jun 2007 18:31:37 +0000 Subject: [PATCH] `host_name' is a NULL pointer if the "-I" flag is used instead of "-H", so use `server_address' instead. Fixes a possible segfault when following redirects to relative URLs (reported by Ingo Lantschner). git-svn-id: https://nagiosplug.svn.sourceforge.net/svnroot/nagiosplug/nagiosplug/trunk@1740 f882894a-f735-0410-b71e-b25c423dba1c --- plugins/check_http.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/plugins/check_http.c b/plugins/check_http.c index 86e18de..f2f7a18 100644 --- a/plugins/check_http.c +++ b/plugins/check_http.c @@ -148,7 +148,7 @@ main (int argc, char **argv) if (display_html == TRUE) printf ("", - use_ssl ? "https" : "http", host_name, + use_ssl ? "https" : "http", server_address, server_port, server_url); /* initialize alarm signal handling, set socket timeout, start timer */ @@ -1141,7 +1141,7 @@ redir (char *pos, char *status_line) } i = server_port; strcpy (type, server_type); - strcpy (addr, host_name); + strcpy (addr, server_address); } else { -- 2.30.2