From d2c9f4554f201bde00281d58d4de600a0e8877a1 Mon Sep 17 00:00:00 2001 From: Maxim Dounin Date: Wed, 13 Feb 2013 14:39:46 +0000 Subject: [PATCH] Fixed false memset warning on Linux with -O3 (ticket #275). Prodded by John Leach. --- src/http/modules/ngx_http_autoindex_module.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/http/modules/ngx_http_autoindex_module.c b/src/http/modules/ngx_http_autoindex_module.c index 450a48e50..fb46d65d1 100644 --- a/src/http/modules/ngx_http_autoindex_module.c +++ b/src/http/modules/ngx_http_autoindex_module.c @@ -489,8 +489,11 @@ ngx_http_autoindex_handler(ngx_http_request_t *r) } b->last = ngx_cpymem(b->last, "", sizeof("") - 1); - ngx_memset(b->last, ' ', NGX_HTTP_AUTOINDEX_NAME_LEN - len); - b->last += NGX_HTTP_AUTOINDEX_NAME_LEN - len; + + if (NGX_HTTP_AUTOINDEX_NAME_LEN - len > 0) { + ngx_memset(b->last, ' ', NGX_HTTP_AUTOINDEX_NAME_LEN - len); + b->last += NGX_HTTP_AUTOINDEX_NAME_LEN - len; + } } *b->last++ = ' ';