tomcat-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Kyle VanderBeek <kylev-jaka...@kylev.com>
Subject PATCH: null terminate jk_stat->active
Date Wed, 05 Nov 2003 01:56:24 GMT
Here is a patch against current CVS to fix a problem I saw and described 
in bug 24314:

http://nagoya.apache.org/bugzilla/show_bug.cgi?id=24314

jk_stat->active (a char[64]) is populated via strncpy() which doesn't 
guarantee that null-termination takes place.  /jkstatus treats "active" 
like a string, so we should null-terminate it, else the jkprintf's in 
jk_worker_status.c may walk right off the end.

Please apply.

-- 
kylev@kylev.com
  Some people have a way with words, while others... erm... thingy.

Index: jk/native2/common/jk_worker_ajp13.c
===================================================================
RCS file: /home/cvspublic/jakarta-tomcat-connectors/jk/native2/common/jk_worker_ajp13.c,v
retrieving revision 1.52
diff -u -r1.52 jk_worker_ajp13.c
--- jk/native2/common/jk_worker_ajp13.c	30 Oct 2003 20:08:36 -0000	1.52
+++ jk/native2/common/jk_worker_ajp13.c	5 Nov 2003 01:49:52 -0000
@@ -565,7 +565,9 @@
 
     /* XXX configurable ? */
     strncpy( e->stats->active, s->req_uri, 64);
-    
+    /* Be sure this is null terminated if it's a long url */
+    e->stats->active[63] = '\0';
+
     /* Prepare the messages we'll use.*/ 
     e->request->reset( env, e->request );
     e->reply->reset( env, e->reply );

---------------------------------------------------------------------
To unsubscribe, e-mail: tomcat-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tomcat-dev-help@jakarta.apache.org


Mime
View raw message