From b9548623f811473f6624f0f286625486e444eb29 Mon Sep 17 00:00:00 2001 From: Holger Weiss Date: Sun, 14 Oct 2007 22:19:29 +0000 Subject: [PATCH] Fix a possible segfault if using "-f follow" and the server sends a forged "LLLLocation" header prefixed with multiple "L"s (fabiodds - 1813346) git-svn-id: https://nagiosplug.svn.sourceforge.net/svnroot/nagiosplug/nagiosplug/trunk@1807 f882894a-f735-0410-b71e-b25c423dba1c --- plugins/check_http.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/plugins/check_http.c b/plugins/check_http.c index 2481935..901f6b6 100644 --- a/plugins/check_http.c +++ b/plugins/check_http.c @@ -1062,7 +1062,6 @@ check_http (void) /* per RFC 2396 */ -#define HDR_LOCATION "%*[Ll]%*[Oo]%*[Cc]%*[Aa]%*[Tt]%*[Ii]%*[Oo]%*[Nn]: " #define URI_HTTP "%5[HTPShtps]" #define URI_HOST "%255[-.abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789]" #define URI_PORT "%6d" /* MAX_PORT's width is 5 chars, 6 to detect overflow */ @@ -1092,7 +1091,7 @@ redir (char *pos, char *status_line) die (STATE_UNKNOWN, _("HTTP UNKNOWN - Could not allocate url\n")); while (pos) { - sscanf (pos, "%[Ll]%*[Oo]%*[Cc]%*[Aa]%*[Tt]%*[Ii]%*[Oo]%*[Nn]:%n", xx, &i); + sscanf (pos, "%1[Ll]%*1[Oo]%*1[Cc]%*1[Aa]%*1[Tt]%*1[Ii]%*1[Oo]%*1[Nn]:%n", xx, &i); if (i == 0) { pos += (size_t) strcspn (pos, "\r\n"); pos += (size_t) strspn (pos, "\r\n"); -- 2.30.2