bug in autoindex module

Maxim Dounin mdounin at mdounin.ru
Thu Dec 31 17:16:26 MSK 2009


Hello!

On Thu, Dec 31, 2009 at 02:05:04AM +0300, Maxim Dounin wrote:

> On Wed, Dec 30, 2009 at 01:16:42PM -0500, Ross wrote:

[...]

> > I wonder if this is related to a bug in which the autoindex module
> > occasionally truncates non-ASCII filenames.
> > 
> > Examples of the bug can be found at http://thegodlikehobo.org/tmp/
> > Each file contains its own name. The 4th (Списки), 7th (テスト), and 8th
> > (フロリダ) files from the top have had their name truncated, but the link
> > is correct.
> 
> No, it's unrelated problem.  I'm able to reproduce it here, I'll 
> take a look.

Patch.

Maxim Dounin
-------------- next part --------------
# HG changeset patch
# User Maxim Dounin <mdounin at mdounin.ru>
# Date 1262224940 -10800
# Node ID e06f16583f28f61683e123360902b934fdb8f929
# Parent  1373d689c4b2d03c83f811781427960143345f83
Autoindex: fix utf-8 handling.

diff --git a/src/core/ngx_string.c b/src/core/ngx_string.c
--- a/src/core/ngx_string.c
+++ b/src/core/ngx_string.c
@@ -1239,10 +1239,8 @@ ngx_utf8_cpystrn(u_char *dst, u_char *sr
             break;
         }
 
-        len--;
-
         while (src < next) {
-            *++dst = *++src;
+            *dst++ = *src++;
             len--;
         }
     }


More information about the nginx mailing list