aboutsummaryrefslogtreecommitdiffstats
path: root/src/libutil/http.c
diff options
context:
space:
mode:
authorVsevolod Stakhov <vsevolod@highsecure.ru>2017-01-08 18:37:07 +0000
committerVsevolod Stakhov <vsevolod@highsecure.ru>2017-01-08 18:59:56 +0000
commitfbb1cb12a6e0e17a143593adf60483ad1e70fbca (patch)
treedbd2d66bd661e13ba976043fb80966d3f0b6ad60 /src/libutil/http.c
parentf22e29d1bf2b850ff79e5959a19df534744de75f (diff)
downloadrspamd-fbb1cb12a6e0e17a143593adf60483ad1e70fbca.tar.gz
rspamd-fbb1cb12a6e0e17a143593adf60483ad1e70fbca.zip
[Test] More test cases
Diffstat (limited to 'src/libutil/http.c')
-rw-r--r--src/libutil/http.c18
1 files changed, 13 insertions, 5 deletions
diff --git a/src/libutil/http.c b/src/libutil/http.c
index fdc9d1294..a981d1f41 100644
--- a/src/libutil/http.c
+++ b/src/libutil/http.c
@@ -3549,11 +3549,7 @@ rspamd_http_normalize_path_inplace (gchar *path, gsize len, gsize *nlen)
}
else {
/* We have something like bla../, so we need to copy it as is */
-
- if (slash) {
- *o ++ = '/';
- }
- if (dot && p > dot) {
+ if (o > path && dot && p > dot) {
memcpy (o, dot, p - dot);
o += p - dot;
}
@@ -3612,6 +3608,18 @@ rspamd_http_normalize_path_inplace (gchar *path, gsize len, gsize *nlen)
o = (gchar *)slash;
}
}
+ else {
+ /* Corner case */
+ if (o == path) {
+ *o++ = '/';
+ }
+ else {
+ if (dot && p > dot) {
+ memmove (o, dot, p - dot);
+ o += p - dot;
+ }
+ }
+ }
break;
case st_got_slash:
*o++ = '/';