You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@httpd.apache.org by Ben Laurie <be...@gonzo.ben.algroup.co.uk> on 1996/05/16 18:05:47 UTC

Re: rprintf lives

Randy Terbush wrote:
> 
> I took a stab at reimplementing rprintf() in hopes to eliminate some
> of the incompatibility with older modules. Here's a patch relative
> to current source.  If this does not get shot down, could someone
> please commit it?

The reason rprintf has not been implemented in this way is the security risk
associated with the fixed length buffer. In the old scheme of things it
translated to an fprintf, which has no such problem. This is why there was all
the talk of nabbing someone's printf code to incorporate.

Cheers,

Ben.

> 
> 
> *** http_protocol.h.orig	Thu May 16 11:18:01 1996
> --- http_protocol.h	Thu May 16 11:06:10 1996
> ***************
> *** 104,112 ****
>    * definitions of the macros would get a whole lot hairier.
>    */
>        
> - #if 0
>   long rprintf (request_rec *r, char *s, ...);     
> - #endif
>   int rputc (int c, request_rec *r);     
>   extern int rputs(const char *str, request_rec *r);
>   extern int rvputs(request_rec *r, ...);
> --- 104,110 ----
> *** http_protocol.c.orig	Thu May 16 10:24:47 1996
> --- http_protocol.c	Thu May 16 11:20:31 1996
> ***************
> *** 776,781 ****
> --- 776,808 ----
>       return k;
>   }
>   
> + long
> + rprintf (request_rec *r, char *fmt, ...)
> + {
> +     va_list args;
> +     int i, retval;
> +     char buf[MAX_STRING_LEN];
> +     BUFF *fb = r->connection->client;
> +     
> +     if (r->connection->aborted) return EOF;
> +     
> +     va_start (args, fmt);
> +     retval = vsnprintf (buf, MAX_STRING_LEN, fmt, args);
> +     
> +     if (retval > 0)
> +     {
> + 	i = bwrite(fb, buf, retval);
> + 	if (i != retval)
> + 	{
> + 	    va_end(args);
> + 	    return -1;
> + 	}
> +     }
> +     va_end (args);
> + 
> +     return (retval);
> + }
> + 
>   void send_error_response (request_rec *r, int recursive_error)
>   {
>       conn_rec *c = r->connection;
> 
> 
> 

-- 
Ben Laurie                  Phone: +44 (181) 994 6435
Freelance Consultant and    Fax:   +44 (181) 994 6472
Technical Director          Email: ben@algroup.co.uk
A.L. Digital Ltd,           URL: http://www.algroup.co.uk
London, England.

Re: rprintf lives

Posted by Dean Gaudet <dg...@hotwired.com>.
In article <19...@ooo.lanl.gov> you write:
>As a Brit in the US, when I speak to people I have to map lots of
>words into American English, as well as talk about "dot zee" files
>etc :-)

Just say zed and make them learn that they don't speak correct english.
Anyone know the reason Americans pronounce it zee instead of zed like the
rest of the english speaking world?  I once said, as a joke, that it was
so that the alphabet song would rhyme... the person believed me.  oops.

One Canadianism (or is it used by English as well?) that Americans seem to
have trouble with is "serviette" for "napkin".  I still haven't trained
myself to translate it.

Dean