initialize request fields used as output in log
this could crash quark or print gibberish if the connection is closed before parsing these fields: r->target is uninitialized, but printed in the log.
This commit is contained in:
parent
5030846333
commit
f5270aa241
1 changed files with 3 additions and 5 deletions
8
quark.c
8
quark.c
|
@ -176,6 +176,9 @@ getrequest(int fd, struct request *r)
|
||||||
ssize_t off;
|
ssize_t off;
|
||||||
char h[HEADER_MAX], *p, *q;
|
char h[HEADER_MAX], *p, *q;
|
||||||
|
|
||||||
|
/* empty all fields */
|
||||||
|
memset(r, 0, sizeof(*r));
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* receive header
|
* receive header
|
||||||
*/
|
*/
|
||||||
|
@ -264,11 +267,6 @@ getrequest(int fd, struct request *r)
|
||||||
* parse request-fields
|
* parse request-fields
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/* empty all fields */
|
|
||||||
for (i = 0; i < NUM_REQ_FIELDS; i++) {
|
|
||||||
r->field[i][0] = '\0';
|
|
||||||
}
|
|
||||||
|
|
||||||
/* match field type */
|
/* match field type */
|
||||||
for (; *p != '\0';) {
|
for (; *p != '\0';) {
|
||||||
for (i = 0; i < NUM_REQ_FIELDS; i++) {
|
for (i = 0; i < NUM_REQ_FIELDS; i++) {
|
||||||
|
|
Loading…
Reference in a new issue