summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJustus Winter <justus@sequoia-pgp.org>2023-07-05 14:47:53 +0200
committerJustus Winter <justus@sequoia-pgp.org>2023-07-05 14:47:53 +0200
commitfe58f69466d947f51d7bd43e474f5fec2e8e7cc9 (patch)
tree37d72ded8915f9945b4776547dfcfa4ff033f270
parent5b87166666ebfc97467946c58735b7c942451315 (diff)
openpgp: Fix body length computation.
-rw-r--r--openpgp/src/parse.rs4
1 files changed, 2 insertions, 2 deletions
diff --git a/openpgp/src/parse.rs b/openpgp/src/parse.rs
index d78fff36..f5b3bff8 100644
--- a/openpgp/src/parse.rs
+++ b/openpgp/src/parse.rs
@@ -531,8 +531,8 @@ impl<'a> PacketHeaderParser<'a> {
// Steal the body for the map.
self.reader.rewind();
let body = self.reader.steal_eof()?;
- if !body.is_empty() {
- self.field("body", body.len());
+ if body.len() > total_out {
+ self.field("body", body.len() - total_out);
}
self.map.as_mut().unwrap().finalize(body);
}