]> git.ipfire.org Git - thirdparty/suricata.git/commitdiff
http2: asymetric sizes for headers tables
authorPhilippe Antoine <contact@catenacyber.fr>
Tue, 6 Oct 2020 07:46:14 +0000 (09:46 +0200)
committerJason Ish <jason.ish@oisf.net>
Wed, 7 Oct 2020 15:40:38 +0000 (09:40 -0600)
The headers table from client to server
and the one from server to client
may have different maximum sizes
(even if both endpoints have to keep both tables)

rust/src/http2/http2.rs

index 9a033010397fabb3cfa3797c1a1cb8df5a73a8a5..8b4112ead6302b8a9b7d39112e36f83547622474 100644 (file)
@@ -466,17 +466,19 @@ impl HTTP2State {
                     Ok((_, set)) => {
                         for i in 0..set.len() {
                             if set[i].id == parser::HTTP2SettingsId::SETTINGSHEADERTABLESIZE {
-                                //set for both endpoints ? to be tested
-                                self.dynamic_headers_tc.max_size = set[i].value as usize;
-                                self.dynamic_headers_ts.max_size = set[i].value as usize;
+                                //reverse order as this is what we accept from the other endpoint
+                                let dyn_headers = if dir == STREAM_TOCLIENT {
+                                    &mut self.dynamic_headers_ts
+                                } else {
+                                    &mut self.dynamic_headers_tc
+                                };
+                                dyn_headers.max_size = set[i].value as usize;
                                 if set[i].value > HTTP2_MAX_TABLESIZE {
                                     //mark potential overflow
-                                    self.dynamic_headers_tc.overflow = 1;
-                                    self.dynamic_headers_ts.overflow = 1;
+                                    dyn_headers.overflow = 1;
                                 } else {
                                     //reset in case peer set a lower value, to be tested
-                                    self.dynamic_headers_tc.overflow = 0;
-                                    self.dynamic_headers_ts.overflow = 0;
+                                    dyn_headers.overflow = 0;
                                 }
                             }
                         }