From bc02c0273d0f0a08ed91ad439b123764c3b39982 Mon Sep 17 00:00:00 2001 From: miker Date: Tue, 24 Jul 2007 01:48:09 +0000 Subject: [PATCH] Patch from Scott McKellar to address potential buffer overflow in router query inside srfsh. git-svn-id: svn://svn.open-ils.org/OpenSRF/trunk@1058 9efc2488-bf62-4759-914b-345cdb29e865 --- src/srfsh/srfsh.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/srfsh/srfsh.c b/src/srfsh/srfsh.c index de6f125..1cc1a19 100644 --- a/src/srfsh/srfsh.c +++ b/src/srfsh/srfsh.c @@ -713,9 +713,11 @@ static int router_query_servers( const char* router_server ) { 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 ); -- 2.11.0