public inbox for gentoo-commits@lists.gentoo.org
 help / color / mirror / Atom feed
* [gentoo-commits] gentoo-x86 commit in net-analyzer/nagios-core/files: statuswml-bug275288.patch
@ 2009-06-24 21:27 Tobias Scherbaum (dertobi123)
  0 siblings, 0 replies; only message in thread
From: Tobias Scherbaum (dertobi123) @ 2009-06-24 21:27 UTC (permalink / raw
  To: gentoo-commits

dertobi123    09/06/24 21:27:24

  Added:                statuswml-bug275288.patch
  Log:
  Revbumps to 2.12-r1, 3.0.6-r2 and also bump to 3.1.2. Includes fix for #275288 (remote code execution in statuswml.cgi).
  (Portage version: 2.2_rc33/cvs/Linux x86_64)

Revision  Changes    Path
1.1                  net-analyzer/nagios-core/files/statuswml-bug275288.patch

file : http://sources.gentoo.org/viewcvs.py/gentoo-x86/net-analyzer/nagios-core/files/statuswml-bug275288.patch?rev=1.1&view=markup
plain: http://sources.gentoo.org/viewcvs.py/gentoo-x86/net-analyzer/nagios-core/files/statuswml-bug275288.patch?rev=1.1&content-type=text/plain

Index: statuswml-bug275288.patch
===================================================================
--- cgi/statuswml.c	2008/11/30 18:13:11	1.27
+++ cgi/statuswml.c	2009/06/19 04:30:26	1.28
@@ -67,6 +67,8 @@
 void document_header(void);
 void document_footer(void);
 int process_cgivars(void);
+int validate_arguments(void);
+int is_valid_hostip(char *hostip);
 
 int display_type=DISPLAY_INDEX;
 int hostgroup_style=DISPLAY_HOSTGROUP_SUMMARY;
@@ -108,6 +110,13 @@
 
 	document_header();
 
+	/* validate arguments in URL */
+	result=validate_arguments();
+	if(result==ERROR){
+		document_footer();
+		return ERROR;
+	        }
+	
 	/* read the CGI configuration file */
 	result=read_cgi_config_file(get_cgi_config_location());
 	if(result==ERROR){
@@ -334,7 +343,25 @@
 	return error;
         }
 
+int validate_arguments(void){
+	int result=OK;
+	if((strcmp(ping_address,"")) && !is_valid_hostip(ping_address)) {
+		printf("<p>Invalid host name/ip</p>\n");
+		result=ERROR;
+		}
+	if(strcmp(traceroute_address,"") && !is_valid_hostip(traceroute_address)){
+		printf("<p>Invalid host name/ip</p>\n");
+		result=ERROR;
+		}
+	return result;
+	}
 
+int is_valid_hostip(char *hostip) {
+	char *valid_domain_chars="abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789.-";
+	if(strcmp(hostip,"") && strlen(hostip)==strspn(hostip,valid_domain_chars) && hostip[0] != '-' && hostip[strlen(hostip)-1] != '-')
+		return TRUE;
+	return FALSE;
+	}
 
 /* main intro screen */
 void display_index(void){






^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2009-06-24 21:27 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-06-24 21:27 [gentoo-commits] gentoo-x86 commit in net-analyzer/nagios-core/files: statuswml-bug275288.patch Tobias Scherbaum (dertobi123)

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox