fixed ../ bug

This commit is contained in:
overflowerror 2019-03-08 16:06:33 +01:00
parent 16a21a2f30
commit 0d56b113e1
3 changed files with 3 additions and 6 deletions

View file

@ -232,11 +232,10 @@ int headers_metadata(struct metaData* metaData, char* header) {
else
return HEADERS_PARSE_ERROR;
char* path = malloc(strlen(_path) + 1);
char* path = symbolicRealpath(_path);
if (path == NULL) {
return HEADERS_ALLOC_ERROR;
}
strcpy(path, _path);
char* queryString = malloc(strlen(_queryString) + 1);
if (queryString == NULL) {
free(path);

View file

@ -19,6 +19,8 @@ struct handlerSettings {
struct handler handlerGetter(struct metaData metaData, const char* host, struct bind* bind) {
struct handlerSettings* settings = (struct handlerSettings*) bind->settings.ptr;
info("%s", metaData.path);
union userData data;
if (isInDir(metaData.path, settings->cgiBin)) {

View file

@ -109,10 +109,6 @@ char* symbolicRealpath(const char* file) {
int isInDir(const char* file, const char* dir) {
int length = strlen(dir);
if (dir[length - 1] == '/')
length--;