comparison src/http/ngx_http_spdy.c @ 5616:b93db4e4ff77

SPDY: improved ngx_http_spdy_state_save() check.
author Maxim Dounin <mdounin@mdounin.ru>
date Wed, 19 Mar 2014 12:57:39 +0400
parents 6c7f9fd5fd7e
children c15350f4071c
comparison
equal deleted inserted replaced
5615:02ee639d18a8 5616:b93db4e4ff77
1870 1870
1871 static u_char * 1871 static u_char *
1872 ngx_http_spdy_state_save(ngx_http_spdy_connection_t *sc, 1872 ngx_http_spdy_state_save(ngx_http_spdy_connection_t *sc,
1873 u_char *pos, u_char *end, ngx_http_spdy_handler_pt handler) 1873 u_char *pos, u_char *end, ngx_http_spdy_handler_pt handler)
1874 { 1874 {
1875 #if 1 1875 size_t size;
1876 if (end - pos > NGX_SPDY_STATE_BUFFER_SIZE) { 1876
1877 size = end - pos;
1878
1879 if (size > NGX_SPDY_STATE_BUFFER_SIZE) {
1877 ngx_log_error(NGX_LOG_ALERT, sc->connection->log, 0, 1880 ngx_log_error(NGX_LOG_ALERT, sc->connection->log, 0,
1878 "spdy state buffer overflow: " 1881 "spdy state buffer overflow: "
1879 "%z bytes required", end - pos); 1882 "%z bytes required", end - pos);
1880 return ngx_http_spdy_state_internal_error(sc); 1883 return ngx_http_spdy_state_internal_error(sc);
1881 } 1884 }
1882 #endif
1883 1885
1884 ngx_memcpy(sc->buffer, pos, NGX_SPDY_STATE_BUFFER_SIZE); 1886 ngx_memcpy(sc->buffer, pos, NGX_SPDY_STATE_BUFFER_SIZE);
1885 1887
1886 sc->buffer_used = end - pos; 1888 sc->buffer_used = end - pos;
1887 sc->handler = handler; 1889 sc->handler = handler;