Skip to content

Commit bd7b43f

Browse files
leongrossembediver
authored andcommitted
fix minimum required length check for responder
Signed-off-by: leongross <leon.gross@9elements.com>
1 parent 3308936 commit bd7b43f

File tree

2 files changed

+8
-2
lines changed

2 files changed

+8
-2
lines changed

src/commands/algorithms/mod.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -188,8 +188,7 @@ impl NegotiateAlgorithmsReq {
188188
+ size_of::<NegotiateAlgorithmsReq>()
189189
+ total_alg_struct_len
190190
+ total_ext_asym_len
191-
+ total_ext_hash_len
192-
+ 4) as u16
191+
+ total_ext_hash_len) as u16
193192
}
194193

195194
/// Calculate the size of the extended algorithm structures in bytes.

src/commands/algorithms/response.rs

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -134,6 +134,13 @@ fn process_negotiate_algorithms_request<'a>(
134134
if fixed_alg_count != 2 {
135135
Err(ctx.generate_error_response(req_payload, ErrorCode::InvalidRequest, 0, None))?;
136136
}
137+
138+
// Skip extended algorithm structures embedded in this AlgStructure
139+
for _ in 0..ext_alg_count {
140+
ExtendedAlgo::decode(req_payload).map_err(|_| {
141+
ctx.generate_error_response(req_payload, ErrorCode::InvalidRequest, 0, None)
142+
})?;
143+
}
137144
}
138145

139146
// Total number of extended algorithms check

0 commit comments

Comments
 (0)