diff options
author | Patrick Rudolph <patrick.rudolph@9elements.com> | 2018-03-16 12:25:28 +0100 |
---|---|---|
committer | Patrick Georgi <pgeorgi@google.com> | 2018-03-26 10:19:11 +0000 |
commit | f595ba2a9eaa5a80ec09f7003d5328ee78b80353 (patch) | |
tree | 6d29623296f5165f3a9f8b621b15133ca581130a | |
parent | cf1ba95fa4daffecaa9d1764163c28e7acf24c6c (diff) |
lib/lzma: Respect dstn argument
Don't write more bytes than the caller requests.
Based on I484b5c1e3809781033d146609a35a9e5e666c8ed.
Change-Id: I336de417c7cd6f35cf84947fc4ae161c15bd93ef
Signed-off-by: Patrick Rudolph <patrick.rudolph@9elements.com>
Reviewed-on: https://review.coreboot.org/25222
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Reviewed-by: Patrick Georgi <pgeorgi@google.com>
-rw-r--r-- | src/lib/lzma.c | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/src/lib/lzma.c b/src/lib/lzma.c index f72755392c..dbc464cc80 100644 --- a/src/lib/lzma.c +++ b/src/lib/lzma.c @@ -37,6 +37,8 @@ size_t ulzman(const void *src, size_t srcn, void *dst, size_t dstn) * byte and re-construct. */ cp = src + LZMA_PROPERTIES_SIZE; outSize = cp[3] << 24 | cp[2] << 16 | cp[1] << 8 | cp[0]; + if (outSize > dstn) + outSize = dstn; if (LzmaDecodeProperties(&state.Properties, properties, LZMA_PROPERTIES_SIZE) != LZMA_RESULT_OK) { printk(BIOS_WARNING, "lzma: Incorrect stream properties.\n"); |