#893 closed defect (fixed)
Possible buffer overrun
| Reported by: | Owned by: | ||
|---|---|---|---|
| Priority: | minor | Milestone: | 1.9 |
| Component: | nginx-module | Version: | 1.9.x |
| Keywords: | Cc: | ||
| uname -a: | |||
| nginx -V: | 1.9.10 | ||
Description
Piece of code in file 'ngx_http_v2_filter_module.c', function ngx_http_v2_header_filter:
len += 1 + clcf->server_tokens ? ngx_http_v2_literal_size(NGINX_VER)
: ngx_http_v2_literal_size("nginx");
Here is calculating the length of the memory block that is allocated and filled in later. 1 not added, one byte out of allocated buffer access possible.
Expected behavior: add 1, then add size of one of two litetals.
Actual behavior: due to operator pecedence ('+' has greater priority than ternary condition), always add only size of first literal.
Change History (4)
comment:1 by , 10 years ago
| Status: | new → accepted |
|---|
comment:3 by , 10 years ago
| Resolution: | → fixed |
|---|---|
| Status: | accepted → closed |
comment:4 by , 9 years ago
| sensitive: | 1 → 0 |
|---|
Note:
See TracTickets
for help on using tickets.

Nice catch, thanks.