summaryrefslogtreecommitdiffstats
path: root/libvncserver
diff options
context:
space:
mode:
authorChristian Beier <dontmind@freeshell.org>2015-04-17 12:07:16 +0200
committerChristian Beier <dontmind@freeshell.org>2015-04-17 12:07:16 +0200
commit107109492e37f0b508f55b5b4e4bd8dcfae3d0cf (patch)
tree846841a83ec80d9ee5afc0342e034cd2c49b1c5a /libvncserver
parentf5abd4ab20641747b6eb12aac20d7a4786363e02 (diff)
parentf5ae94639bad542e6ae2b57495cb975bd8feb45e (diff)
downloadlibtdevnc-107109492e37f0b508f55b5b4e4bd8dcfae3d0cf.tar.gz
libtdevnc-107109492e37f0b508f55b5b4e4bd8dcfae3d0cf.zip
Merge pull request #70 from maxnet/master
httpd: disallow directory traversal
Diffstat (limited to 'libvncserver')
-rw-r--r--libvncserver/httpd.c8
1 files changed, 8 insertions, 0 deletions
diff --git a/libvncserver/httpd.c b/libvncserver/httpd.c
index 12d71a8..2a778e7 100644
--- a/libvncserver/httpd.c
+++ b/libvncserver/httpd.c
@@ -423,6 +423,14 @@ httpProcessInput(rfbScreenInfoPtr rfbScreen)
}
}
+ /* Basic protection against directory traversal outside webroot */
+
+ if (strstr(fname, "..")) {
+ rfbErr("httpd: URL should not contain '..'\n");
+ rfbWriteExact(&cl, NOT_FOUND_STR, strlen(NOT_FOUND_STR));
+ httpCloseSock(rfbScreen);
+ return;
+ }
/* If we were asked for '/', actually read the file index.vnc */