tomcat-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Guenter Knauf <fua...@apache.org>
Subject Re: snprintf/vsnprintf in mod_jk
Date Sat, 14 Apr 2007 13:24:03 GMT
Hi,
> We have those routines twice (in jk_util.c and jk_status.c).
> We are also assuming that the platforms always have snprintf() in
> jk_lb_worker.c for example.
yes, and that was one reason why I couldnt build post-1.2.15 versions for NetWare Apache 1.3.x
and Netscape.

> In jk_global.h there is:
> +++
> /* XXXX There is a snprintf() and vsnprintf() in jk_util.c */
> /* if those work remove the #define. */
> #if defined(NETWARE) || defined(AS400)
> #define USE_SPRINTF
> #define USE_VSPRINTF
> #endif
> +++

> Could someone check that the snprintf() and snprintf() of jk_util.c are
> working on NETWARE and AS400?
I've just checked with these, and they dont work for NetWare because we have no /dev/null
support.
Therefore I would like to suggest another approach: let us import ap_snprintf.c from Apache
1.3.x into the mod_jk project.
I think this is a good solution; we have there a ready-to-use stable implementation, and every
platform which lacks of an own snprintf() / vsnprintf() implementation can then pick this
up only when not build with/for Apache; when build with Apache 1.3.x then its even not needed
to compile this external ap_snprintf.c because then we can directly import ap_snprintf() /
ap_vsnprint() from Apache, and only need the defines in jk_global.h.

I have hacked a new header ap_snprintf.h:
http://people.apache.org/~fuankg/diffs/ap_snprintf.h

and patched ap_snprintf.c from Apache 1.3.37 to build standalone:
http://people.apache.org/~fuankg/diffs/ap_snprintf.c.diff

then changed the defines in jk_global.h:
http://people.apache.org/~fuankg/diffs/jk_global.h.diff

these changes let me again build mod_jk for Apache 1.3 and also the Netscape plugin for NetWare
platform.

Also we can then remove the other snprintf() / vsnprintf() functions, and remove the USE_SPRINTF
and USE_VSPRINTF hacks completely which is also important because it removes a potential buffer
overflow.

anybody out there who can test this with AS400?

comments welcome!

greets, Guenter,



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


Mime
View raw message