516 |
else { |
else { |
517 |
/* check that the path begins with / */ |
/* check that the path begins with / */ |
518 |
if (file_coverage->id[0] == '/') { |
if (file_coverage->id[0] == '/') { |
519 |
char * source_path = make_path(document_root, file_coverage->id + 1); |
char * decoded_path = decode_uri_component(file_coverage->id); |
520 |
|
if (strstr(decoded_path, "..") != NULL) { |
521 |
|
free(decoded_path); |
522 |
|
fputs("[]", f); |
523 |
|
HTTPServer_log_err("Warning: invalid source path: %s\n", file_coverage->id); |
524 |
|
goto done; |
525 |
|
} |
526 |
|
char * source_path = make_path(document_root, decoded_path + 1); |
527 |
|
free(decoded_path); |
528 |
FILE * source_file = fopen(source_path, "rb"); |
FILE * source_file = fopen(source_path, "rb"); |
529 |
free(source_path); |
free(source_path); |
530 |
if (source_file == NULL) { |
if (source_file == NULL) { |
571 |
} |
} |
572 |
fputc(']', f); |
fputc(']', f); |
573 |
} |
} |
574 |
|
done: |
575 |
fputc('}', f); |
fputc('}', f); |
576 |
} |
} |
577 |
|
|