Fix segv error when filename is zero length (data

Maxim Dounin mdounin at mdounin.ru
Tue Apr 7 18:05:29 UTC 2015


Hello!

On Tue, Apr 07, 2015 at 07:39:19PM +0200, Bart Warmerdam wrote:

> # HG changeset patch
> # User Bart Warmerdam <bartw at xs4all.nl>
> # Date 1428423894 -7200
> #      Tue Apr 07 18:24:54 2015 +0200
> # Branch ngx_files
> # Node ID 6f5542336a1a0487c8c8b05883596752019de4f5
> # Parent  a70af6f10942d7d21d140049b432081e8c76ba35
> Change format of print string to ngx_str type.
> 
> diff -r a70af6f10942 -r 6f5542336a1a src/os/unix/ngx_files.c
> --- a/src/os/unix/ngx_files.c   Tue Apr 07 18:35:33 2015 +0300
> +++ b/src/os/unix/ngx_files.c   Tue Apr 07 18:24:54 2015 +0200
> @@ -36,7 +36,7 @@
> 
>       if (n == -1) {
>           ngx_log_error(NGX_LOG_CRIT, file->log, ngx_errno,
> -                      "pread() \"%s\" failed", file->name.data);
> +                      "pread() \"%V\" failed", &file->name);
>           return NGX_ERROR;
>       }

The patch looks wrong.  File names are expected to be 
null-terminated, and if it's not true - the error is in the 
caller. 

-- 
Maxim Dounin
http://nginx.org/



More information about the nginx-devel mailing list