[Opensrf-commits] r1058 - trunk/src/srfsh

svn at svn.open-ils.org svn at svn.open-ils.org
Mon Jul 23 21:49:00 EDT 2007


Author: miker
Date: 2007-07-23 21:48:09 -0400 (Mon, 23 Jul 2007)
New Revision: 1058

Modified:
   trunk/src/srfsh/srfsh.c
Log:
Patch from Scott McKellar to address potential buffer overflow in router query inside srfsh.



Modified: trunk/src/srfsh/srfsh.c
===================================================================
--- trunk/src/srfsh/srfsh.c	2007-07-23 17:44:46 UTC (rev 1057)
+++ trunk/src/srfsh/srfsh.c	2007-07-24 01:48:09 UTC (rev 1058)
@@ -713,9 +713,11 @@
 	if( ! router_server || strlen(router_server) == 0 ) 
 		return 0;
 
-	char rbuf[256];
-	memset(rbuf,0,256);
-	sprintf(rbuf,"router@%s/router", router_server );
+	const static char router_text[] = "router@%s/router";
+	size_t len = sizeof( router_text ) + strlen( router_server );
+	char rbuf[len];
+	rbuf[0] = '\0';
+	sprintf(rbuf, router_text, router_server );
 		
 	transport_message* send = 
 		message_init( "servers", NULL, NULL, rbuf, NULL );



More information about the opensrf-commits mailing list