diff options
author | Ruslan Ermilov <ru@nginx.com> | 2012-05-16 13:27:04 +0000 |
---|---|---|
committer | Ruslan Ermilov <ru@nginx.com> | 2012-05-16 13:27:04 +0000 |
commit | 1b4397443fa707bbfcafb86bb1b0bb326f6d3adf (patch) | |
tree | 75071a25758356a57150d4a8de52b3500f51c06d /src | |
parent | befc111d4f1b0986998e7fa0451f52e874afcb19 (diff) | |
download | nginx-1b4397443fa707bbfcafb86bb1b0bb326f6d3adf.tar.gz nginx-1b4397443fa707bbfcafb86bb1b0bb326f6d3adf.zip |
Zero padded the returned and logged HTTP status code, and fixed possible
buffer overrun in $status handling.
Diffstat (limited to 'src')
-rw-r--r-- | src/http/modules/ngx_http_log_module.c | 4 | ||||
-rw-r--r-- | src/http/ngx_http_header_filter_module.c | 2 |
2 files changed, 3 insertions, 3 deletions
diff --git a/src/http/modules/ngx_http_log_module.c b/src/http/modules/ngx_http_log_module.c index 2d412853b..b3c9a1126 100644 --- a/src/http/modules/ngx_http_log_module.c +++ b/src/http/modules/ngx_http_log_module.c @@ -205,7 +205,7 @@ static ngx_http_log_var_t ngx_http_log_vars[] = { { ngx_string("msec"), NGX_TIME_T_LEN + 4, ngx_http_log_msec }, { ngx_string("request_time"), NGX_TIME_T_LEN + 4, ngx_http_log_request_time }, - { ngx_string("status"), 3, ngx_http_log_status }, + { ngx_string("status"), NGX_INT_T_LEN, ngx_http_log_status }, { ngx_string("bytes_sent"), NGX_OFF_T_LEN, ngx_http_log_bytes_sent }, { ngx_string("body_bytes_sent"), NGX_OFF_T_LEN, ngx_http_log_body_bytes_sent }, @@ -593,7 +593,7 @@ ngx_http_log_status(ngx_http_request_t *r, u_char *buf, ngx_http_log_op_t *op) status = 0; } - return ngx_sprintf(buf, "%ui", status); + return ngx_sprintf(buf, "%03ui", status); } diff --git a/src/http/ngx_http_header_filter_module.c b/src/http/ngx_http_header_filter_module.c index 8a6080f60..19f531b5d 100644 --- a/src/http/ngx_http_header_filter_module.c +++ b/src/http/ngx_http_header_filter_module.c @@ -445,7 +445,7 @@ ngx_http_header_filter(ngx_http_request_t *r) b->last = ngx_copy(b->last, status_line->data, status_line->len); } else { - b->last = ngx_sprintf(b->last, "%ui", status); + b->last = ngx_sprintf(b->last, "%03ui", status); } *b->last++ = CR; *b->last++ = LF; |