mirror of
https://github.com/sigmasternchen/CFloor
synced 2025-03-15 20:28:56 +00:00
fixed ../ bug
This commit is contained in:
parent
16a21a2f30
commit
0d56b113e1
3 changed files with 3 additions and 6 deletions
|
@ -232,11 +232,10 @@ int headers_metadata(struct metaData* metaData, char* header) {
|
||||||
else
|
else
|
||||||
return HEADERS_PARSE_ERROR;
|
return HEADERS_PARSE_ERROR;
|
||||||
|
|
||||||
char* path = malloc(strlen(_path) + 1);
|
char* path = symbolicRealpath(_path);
|
||||||
if (path == NULL) {
|
if (path == NULL) {
|
||||||
return HEADERS_ALLOC_ERROR;
|
return HEADERS_ALLOC_ERROR;
|
||||||
}
|
}
|
||||||
strcpy(path, _path);
|
|
||||||
char* queryString = malloc(strlen(_queryString) + 1);
|
char* queryString = malloc(strlen(_queryString) + 1);
|
||||||
if (queryString == NULL) {
|
if (queryString == NULL) {
|
||||||
free(path);
|
free(path);
|
||||||
|
|
|
@ -19,6 +19,8 @@ struct handlerSettings {
|
||||||
struct handler handlerGetter(struct metaData metaData, const char* host, struct bind* bind) {
|
struct handler handlerGetter(struct metaData metaData, const char* host, struct bind* bind) {
|
||||||
struct handlerSettings* settings = (struct handlerSettings*) bind->settings.ptr;
|
struct handlerSettings* settings = (struct handlerSettings*) bind->settings.ptr;
|
||||||
|
|
||||||
|
info("%s", metaData.path);
|
||||||
|
|
||||||
union userData data;
|
union userData data;
|
||||||
|
|
||||||
if (isInDir(metaData.path, settings->cgiBin)) {
|
if (isInDir(metaData.path, settings->cgiBin)) {
|
||||||
|
|
|
@ -109,10 +109,6 @@ char* symbolicRealpath(const char* file) {
|
||||||
int isInDir(const char* file, const char* dir) {
|
int isInDir(const char* file, const char* dir) {
|
||||||
int length = strlen(dir);
|
int length = strlen(dir);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
if (dir[length - 1] == '/')
|
if (dir[length - 1] == '/')
|
||||||
length--;
|
length--;
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue