summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorHolger Weiss <hweiss@users.sourceforge.net>2007-10-14 22:19:29 +0000
committerHolger Weiss <hweiss@users.sourceforge.net>2007-10-14 22:19:29 +0000
commitb9548623f811473f6624f0f286625486e444eb29 (patch)
treecd8876b3c7627bbd965dbffa4153ea7b1a166c20
parent474d1713cee4227f133e416192760e1aa8632ee2 (diff)
downloadmonitoring-plugins-b9548623f811473f6624f0f286625486e444eb29.tar.gz
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
-rw-r--r--plugins/check_http.c3
1 files changed, 1 insertions, 2 deletions
diff --git a/plugins/check_http.c b/plugins/check_http.c
index 24819359..901f6b66 100644
--- a/plugins/check_http.c
+++ b/plugins/check_http.c
@@ -1062,7 +1062,6 @@ check_http (void)
1062 1062
1063 1063
1064/* per RFC 2396 */ 1064/* per RFC 2396 */
1065#define HDR_LOCATION "%*[Ll]%*[Oo]%*[Cc]%*[Aa]%*[Tt]%*[Ii]%*[Oo]%*[Nn]: "
1066#define URI_HTTP "%5[HTPShtps]" 1065#define URI_HTTP "%5[HTPShtps]"
1067#define URI_HOST "%255[-.abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789]" 1066#define URI_HOST "%255[-.abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789]"
1068#define URI_PORT "%6d" /* MAX_PORT's width is 5 chars, 6 to detect overflow */ 1067#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)
1092 die (STATE_UNKNOWN, _("HTTP UNKNOWN - Could not allocate url\n")); 1091 die (STATE_UNKNOWN, _("HTTP UNKNOWN - Could not allocate url\n"));
1093 1092
1094 while (pos) { 1093 while (pos) {
1095 sscanf (pos, "%[Ll]%*[Oo]%*[Cc]%*[Aa]%*[Tt]%*[Ii]%*[Oo]%*[Nn]:%n", xx, &i); 1094 sscanf (pos, "%1[Ll]%*1[Oo]%*1[Cc]%*1[Aa]%*1[Tt]%*1[Ii]%*1[Oo]%*1[Nn]:%n", xx, &i);
1096 if (i == 0) { 1095 if (i == 0) {
1097 pos += (size_t) strcspn (pos, "\r\n"); 1096 pos += (size_t) strcspn (pos, "\r\n");
1098 pos += (size_t) strspn (pos, "\r\n"); 1097 pos += (size_t) strspn (pos, "\r\n");