http_send_response: fix undefined behaviour for copying the target string
... the format string and buffer were the same (undefined behaviour).
This commit is contained in:
parent
ed8b7e8954
commit
444b8f5b32
1 changed files with 2 additions and 1 deletions
3
http.c
3
http.c
|
@ -346,10 +346,11 @@ http_send_response(int fd, struct request *r)
|
||||||
|
|
||||||
/* if we have a vhost prefix, prepend it to the target */
|
/* if we have a vhost prefix, prepend it to the target */
|
||||||
if (s.vhost[i].prefix) {
|
if (s.vhost[i].prefix) {
|
||||||
if (esnprintf(realtarget, sizeof(realtarget), "%s%s",
|
if (esnprintf(tmptarget, sizeof(tmptarget), "%s%s",
|
||||||
s.vhost[i].prefix, realtarget)) {
|
s.vhost[i].prefix, realtarget)) {
|
||||||
return http_send_status(fd, S_REQUEST_TOO_LARGE);
|
return http_send_status(fd, S_REQUEST_TOO_LARGE);
|
||||||
}
|
}
|
||||||
|
memcpy(realtarget, tmptarget, sizeof(realtarget));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue