]> source.dussan.org Git - rspamd.git/commitdiff
[Minor] Another attempt to fix path normalisation
authorVsevolod Stakhov <vsevolod@highsecure.ru>
Tue, 17 Apr 2018 13:11:48 +0000 (14:11 +0100)
committerVsevolod Stakhov <vsevolod@highsecure.ru>
Tue, 17 Apr 2018 13:11:48 +0000 (14:11 +0100)
src/libutil/http.c

index a5133695ba311a8ce21be7532cf7cba3d54ed1a8..03dbaa7bd92e79ede9521355f9b4e043ddfd3f69 100644 (file)
@@ -3780,12 +3780,9 @@ rspamd_http_normalize_path_inplace (gchar *path, guint len, guint *nlen)
                                if (((o > path && *(o - 1) != '/') || (o == path)) && slash) {
                                        /* Preserve one slash */
                                        *o++ = '/';
-                                       slash = p;
-                               }
-                               else {
-                                       slash = NULL;
                                }
 
+                               slash = p;
                                dot = NULL;
                                /* Ignore last slash */
                                state = st_normal;
@@ -3797,7 +3794,7 @@ rspamd_http_normalize_path_inplace (gchar *path, guint len, guint *nlen)
                        else {
                                /* We have something like .some or /.some */
                                if (dot && p > dot) {
-                                       if (slash == dot - 1) {
+                                       if (slash == dot - 1 && (o > path && *(o - 1) != '/')) {
                                                /* /.blah */
                                                memmove (o, slash, p - slash);
                                                o += p - slash;