bug report for nginx version: nginx/1.3.6

Maxim Dounin mdounin at mdounin.ru
Thu Oct 4 15:08:10 UTC 2012


Hello!

On Thu, Oct 04, 2012 at 06:42:42PM +0800, Wang Tiefeng wrote:

> Recently,I start to read nginx source code.
> I chose nginx/1.3.6 a relatively new version。
> 
> When I read file ngx_log.c, the function ngx_log_errno() confused me .
> 
> There may be some bugs in the following codes :
>  238     if (buf > last - 50) {
> 239
> 240         /* leave a space for an error code */
> 241
> 242         buf = last - 50;
> 243         *buf++ = '.';
> 244         *buf++ = '.';
> 245         *buf++ = '.';
> 246     }
> 
> Althoug,I am not sure about my judgment,valgrind reports invalid write on
> line 243.

See no problem here.  The code depends on the fact that the buffer 
used for printing errors is at least 50 bytes long, and the "last" 
pointer marks it's end, but it looks perfectly safe as long as 
ngx_log_errno() is used correctly.

-- 
Maxim Dounin
http://nginx.com/support.html



More information about the nginx-devel mailing list