micro_http: check arithmetic operations

Signed-off-by: Ioana Chirca <chioana@amazon.com>
Signed-off-by: YUAN LYU <lyuyuan92@gmail.com>
This commit is contained in:
Ioana Chirca
2020-07-01 17:01:17 +03:00
committed by Adrian Catangiu
parent 9830b66a09
commit 17ead39d82
4 changed files with 127 additions and 35 deletions

View File

@@ -109,6 +109,7 @@ impl ResponseHeaders {
let delimitator = b", ";
for (idx, method) in self.allow.iter().enumerate() {
buf.write_all(method.raw())?;
// We check above that `self.allow` is not empty.
if idx < self.allow.len() - 1 {
buf.write_all(delimitator)?;
}