> > As for the %*s issue.  We are passing in the length of the string arg in
> > the call:
> >
> >         php_sprintf_appendstring(&result, &outpos, &size,
> >                                  (*args[argnum])->value.str.val,
> >                                  width, precision, padding,
> >                                  alignment,
> >                                  (*args[argnum])->value.str.len,
> >                                  0, expprec);
> >
> > So we have the info.  In php_sprintf_appendstring() the replacement is
> > done using:
> >
> >       strncpy(&(*buffer)[*pos], add, MIN(max_width, len)+1);
> >
> > Looks like simply changing this to a memcpy() call will fix this.  Again,
> > I don't see any reason not to make this change.  PHP is supposed to be
> > 8-bit clean and I think this should extend to the printf functions as
> > well.
>
> That's fine, but I'm not talking about userland sprintf(), but rather
> using C library sprintf() call from inside one of my extension
> functions. If glibc sprintf() doesn't handle NULL bytes, do we have a
> replacement for it in PHP aside from php_formatted_print() which expects
> to receive its arguments from a script?

Oh, and I went and fixed this anyway.

I'd just split that php_formatted_print() function into two parts.  One
that does the argument handling and one that just does the work like we
have done with so many other functions.

-Rasmus


-- 
PHP Development Mailing List <http://www.php.net/>
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]

Reply via email to