B"H net_io.c: http server: content should be dynamically allocated
This commit is contained in:
parent
df19d51bc6
commit
32fc5fddd0
2
net_io.c
2
net_io.c
|
@ -749,7 +749,7 @@ int handleHTTPRequest(struct client *c, char *p) {
|
||||||
hrp = realpath(HTMLPATH, NULL);
|
hrp = realpath(HTMLPATH, NULL);
|
||||||
hrp = (hrp ? hrp : HTMLPATH);
|
hrp = (hrp ? hrp : HTMLPATH);
|
||||||
clen = -1;
|
clen = -1;
|
||||||
content = "Server error";
|
content = calloc(1, 1);
|
||||||
if (rp && (!strncmp(hrp, rp, strlen(hrp)))) {
|
if (rp && (!strncmp(hrp, rp, strlen(hrp)))) {
|
||||||
if (stat(getFile, &sbuf) != -1 && (fd = open(getFile, O_RDONLY)) != -1) {
|
if (stat(getFile, &sbuf) != -1 && (fd = open(getFile, O_RDONLY)) != -1) {
|
||||||
content = (char *) malloc(sbuf.st_size);
|
content = (char *) malloc(sbuf.st_size);
|
||||||
|
|
Loading…
Reference in a new issue