Re: [ZEND-ENGINE-CVS] cvs: Zend(PHP_4_3) / zend.h
| From: | Sascha Schumann | Date: | Thu, 28 Aug 2003 16:57:46 +0000 |
| Subject: | Re: [ZEND-ENGINE-CVS] cvs: Zend(PHP_4_3) / zend.h | ||
| References: | 1 | Groups: | php.zend-engine.cvs |
| Request: | Send a blank email to php-zend-engine-cvs+get-1724@lists.php.net to get a copy of this message | ||
On Thu, 28 Aug 2003, Zeev Suraski wrote:
> At 18:50 28/08/2003, Sascha Schumann wrote:
> >sas Thu Aug 28 11:50:10 2003 EDT
> >
> > Modified files: (Branch: PHP_4_3)
> > /Zend zend.h
> > Log:
> > supply ZEND_ATTRIBUTE_FORMAT and enable it for various format functions
> >
> > # uncovered already a whole bunch of incorrect format strings
>
> What do you mean by incorrect format strings? Is it mandatory to use
> __attribute__(format)?
These two are the most common errors:
- supplying more arguments than used in the format string
- using %d for longs (nasty on 64bit archs)
Additionally, the PHP docref macros are frequently abused,
because their users don't think of them as taking a format
string. Thus they don't escape % which can lead to undefined
behaviour.
Also, passing arguments to commands under safe mode probably
did not work yet -- there was a %s missing in the format
string.
There are also some cases where a pointer is passed to %c, a
struct is passed to %s and so on. These cases are
automatically found when using attribute((format)) - pretty
useful stuff.
- Sascha