changeset 5625:372cc6e532a6

SPDY: detect premature end of frame while start parsing headers.
author Valentin Bartenev <vbart@nginx.com>
date Wed, 26 Mar 2014 17:43:39 +0400
parents bd91f286ee0a
children 2411d4b5be2c
files src/http/ngx_http_spdy.c
diffstat 1 files changed, 9 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/src/http/ngx_http_spdy.c
+++ b/src/http/ngx_http_spdy.c
@@ -1049,6 +1049,15 @@ ngx_http_spdy_state_headers(ngx_http_spd
     if (r->headers_in.headers.part.elts == NULL) {
 
         if (buf->last - buf->pos < NGX_SPDY_NV_NUM_SIZE) {
+
+            if (complete) {
+                ngx_log_error(NGX_LOG_INFO, r->connection->log, 0,
+                              "client sent SYN_STREAM frame "
+                              "with invalid HEADERS block");
+                ngx_http_spdy_close_stream(sc->stream, NGX_HTTP_BAD_REQUEST);
+                return ngx_http_spdy_state_protocol_error(sc);
+            }
+
             return ngx_http_spdy_state_save(sc, pos, end,
                                             ngx_http_spdy_state_headers);
         }