You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@httpd.apache.org by Alexei Kosut <ak...@nueva.pvt.k12.ca.us> on 1997/01/20 07:17:49 UTC

Re: cvs commit: apache/src/modules/proxy proxy_cache.c proxy_ftp.c proxy_http.c proxy_util.c

On Sun, 19 Jan 1997, Jim Jagielski wrote:

>   Change from sprintf() to snprintf() to avoid
>   and possible prevent buffer overflows

I've a question... why isn't ap_snprintf() defined in any header file?
gcc is complaining about this in every file I compile. And it's a Bad
Idea to begin with to not prototype a non-static (and by static I mean
"confined to one file", not "declared to be static").

The top of util_snprintf.h should be in conf.h anyway (IMHO), not
util_snprintf.c. In other words, conf.h should contain (near the
bottom):

#ifdef HAVE_SNPRINTF
#define ap_snprintf     snprintf
#define ap_vsnprintf    vsnprintf
#else
int ap_snprintf(char *buf, size_t len, const char *format,...);
#endif

#ifdef HAVE_CVT
#define ap_ecvt ecvt
#define ap_fcvt fcvt
#define ap_gcvt gcvt
#endif

util_snprintf.c should then #include "conf.h". Regardless, it should:
this allows conf.h to define HAVE_SNPRINTF and HAVE_CVT for various
OSes. Otherwise, there is no way to define these other than in
Configuration, and there's no point to put it there: this is a per-OS
issue and has nothing to do with the Makefile or whatnot (like regex
libraries).

-- 
________________________________________________________________________
Alexei Kosut <ak...@nueva.pvt.k12.ca.us>      The Apache HTTP Server
URL: http://www.nueva.pvt.k12.ca.us/~akosut/   http://www.apache.org/