summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJustus Winter <justus@sequoia-pgp.org>2020-04-01 12:49:39 +0200
committerJustus Winter <justus@sequoia-pgp.org>2020-04-01 13:02:05 +0200
commite7ff6802f7f3ef4803ffaae8292e76d130dc7daa (patch)
tree268430e5883833de08fafd82e115142c640802ff
parentffb9174f86581e006904262265e1abd3fdf7ff54 (diff)
openpgp: Fix subpacket boundary check.
-rw-r--r--openpgp/src/parse.rs2
1 files changed, 1 insertions, 1 deletions
diff --git a/openpgp/src/parse.rs b/openpgp/src/parse.rs
index 72e114aa..b00c2c4d 100644
--- a/openpgp/src/parse.rs
+++ b/openpgp/src/parse.rs
@@ -1308,7 +1308,7 @@ impl Subpacket {
php.field("subpacket length", length.serialized_len());
let len = length.len() as usize;
- if limit < len {
+ if limit < length.serialized_len() + len {
return Err(Error::MalformedPacket(
"Subpacket extends beyond the end of the subpacket area".into())
.into());