Skip to content

Commit

Permalink
Merge pull request #70 from maxnet/master
Browse files Browse the repository at this point in the history
httpd: disallow directory traversal
  • Loading branch information
bk138 committed Apr 17, 2015
2 parents f5abd4a + f5ae946 commit 1071094
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions libvncserver/httpd.c
Original file line number Diff line number Diff line change
Expand Up @@ -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 */

Expand Down

0 comments on commit 1071094

Please sign in to comment.