You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@httpd.apache.org by Greg Stein <gs...@lyra.org> on 2000/11/02 01:15:22 UTC

Re: apr_vformatter mishandles "%n" (patch included)

I've applied this one. Looks good to me.

Cheers,
-g

On Mon, Oct 30, 2000 at 02:44:56PM -0600, Karl Fogel wrote:
> The call
> 
>   apr_psprintf (pool, "%u%n", random_number, &random_portion_width);
> 
> was producing a string that had garbage bytes following the correctly
> formatted number.  Turns out that even for "%n", apr_psprintf() was
> printing into the string.  The bug was in apr_vformatter().
> 
> The patch below is a pretty quick job; if someone else has a more
> elegant fix, that's great too.
> 
> -Karl
> 
> 2000-10-30  Karl Fogel  <kf...@collab.net>
> 
> 	* apr_snprintf.c (apr_vformatter): don't print anything for "%n".
> 
> --- apr_snprintf.c	Mon Oct 30 14:23:52 2000
> +++ apr_snprintf.c	Mon Oct 30 14:30:06 2000
> @@ -708,6 +708,7 @@
>  	    /*
>  	     * Default variable settings
>  	     */
> +            boolean_e print_something = YES;
>  	    adjust = RIGHT;
>  	    alternate_form = print_sign = print_blank = NO;
>  	    pad_char = ' ';
> @@ -1000,6 +1001,7 @@
>  		    *(va_arg(ap, short *)) = cc;
>  		else
>  		    *(va_arg(ap, int *)) = cc;
> +                print_something = NO;
>  		break;
>  
>  		/*
> @@ -1131,10 +1133,12 @@
>  	    /*
>  	     * Print the string s. 
>  	     */
> -	    for (i = s_len; i != 0; i--) {
> -		INS_CHAR(*s, sp, bep, cc);
> -		s++;
> -	    }
> +            if (print_something == YES) {
> +                for (i = s_len; i != 0; i--) {
> +  		    INS_CHAR(*s, sp, bep, cc);
> +		    s++;
> +                }
> +            }
>  
>  	    if (adjust_width && adjust == LEFT && min_width > s_len)
>  		PAD(min_width, s_len, pad_char);

-- 
Greg Stein, http://www.lyra.org/

.htpasswd with WIN32??

Posted by Austin Gonyou <au...@coremetrics.com>.
What is the facility for doing an .htaccess with win32? I didn't find it 
any where. I'd assume using <Directory /x /y> instead. Any suggestions?
Austin