diff options
author | Jo-Philipp Wich <jow@openwrt.org> | 2013-01-26 14:46:59 +0100 |
---|---|---|
committer | Jo-Philipp Wich <jow@openwrt.org> | 2013-01-26 14:46:59 +0100 |
commit | ac7670faba12e23b8ec7e866dcfe1d98d3921b40 (patch) | |
tree | e59a581bcb4b205ac80bc4f9cdbaff28a858d7d6 | |
parent | 2787be7a7d916e6368ab3492f7a942cb2a4464b3 (diff) |
set the docroot to the current working directory if none is specified, fixes random null pointer dereferencing
-rw-r--r-- | main.c | 8 |
1 files changed, 8 insertions, 0 deletions
@@ -399,6 +399,14 @@ int main(int argc, char **argv) return 1; } + if (!conf.docroot) { + if (!realpath(".", uh_buf)) { + fprintf(stderr, "Error: Unable to determine work dir\n"); + return 1; + } + conf.docroot = strdup(uh_buf); + } + #ifdef HAVE_TLS if (n_tls) { if (!tls_crt || !tls_key) { |