Skip to content

Commit 471cbaa

Browse files
committed
Fix: remove tailing dots in URI.
This works around the problem that windows ignores tailing dots. This way you could trick Icecast2 to send a XSLT file as plain text. Please test. Closes: #2247
1 parent 255af9e commit 471cbaa

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

src/util.c

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -379,6 +379,9 @@ char *util_url_unescape (const char *src)
379379
*/
380380
char *util_normalise_uri(const char *uri) {
381381
char *path;
382+
#ifdef _WIN32
383+
size_t len;
384+
#endif
382385

383386
if(uri[0] != '/')
384387
return NULL;
@@ -390,6 +393,12 @@ char *util_normalise_uri(const char *uri) {
390393
return NULL;
391394
}
392395

396+
#ifdef _WIN32
397+
/* If we are on Windows, strip trailing dots, as Win API strips it anyway */
398+
for (len = strlen(path); len > 0 && path[len-1] == '.'; len--)
399+
path[len-1] = '\0';
400+
#endif
401+
393402
/* We now have a full URI-decoded path. Check it for allowability */
394403
if(verify_path(path))
395404
return path;

0 commit comments

Comments
 (0)