[nginx] SPDY: improved ngx_http_spdy_state_save() check.
Maxim Dounin
mdounin at mdounin.ru
Wed Mar 19 14:37:18 UTC 2014
details: http://hg.nginx.org/nginx/rev/b93db4e4ff77
branches:
changeset: 5616:b93db4e4ff77
user: Maxim Dounin <mdounin at mdounin.ru>
date: Wed Mar 19 12:57:39 2014 +0400
description:
SPDY: improved ngx_http_spdy_state_save() check.
diffstat:
src/http/ngx_http_spdy.c | 8 +++++---
1 files changed, 5 insertions(+), 3 deletions(-)
diffs (23 lines):
diff --git a/src/http/ngx_http_spdy.c b/src/http/ngx_http_spdy.c
--- a/src/http/ngx_http_spdy.c
+++ b/src/http/ngx_http_spdy.c
@@ -1872,14 +1872,16 @@ static u_char *
ngx_http_spdy_state_save(ngx_http_spdy_connection_t *sc,
u_char *pos, u_char *end, ngx_http_spdy_handler_pt handler)
{
-#if 1
- if (end - pos > NGX_SPDY_STATE_BUFFER_SIZE) {
+ size_t size;
+
+ size = end - pos;
+
+ if (size > NGX_SPDY_STATE_BUFFER_SIZE) {
ngx_log_error(NGX_LOG_ALERT, sc->connection->log, 0,
"spdy state buffer overflow: "
"%z bytes required", end - pos);
return ngx_http_spdy_state_internal_error(sc);
}
-#endif
ngx_memcpy(sc->buffer, pos, NGX_SPDY_STATE_BUFFER_SIZE);
More information about the nginx-devel
mailing list