[coreboot-gerrit] Change in coreboot[master]: lib/lzma: Respect dstn argument

Patrick Rudolph (Code Review) gerrit at coreboot.org
Fri Mar 16 12:29:36 CET 2018


Patrick Rudolph has uploaded this change for review. ( https://review.coreboot.org/25222


Change subject: lib/lzma: Respect dstn argument
......................................................................

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 at 9elements.com>
---
M src/lib/lzma.c
1 file changed, 2 insertions(+), 0 deletions(-)



  git pull ssh://review.coreboot.org:29418/coreboot refs/changes/22/25222/1

diff --git a/src/lib/lzma.c b/src/lib/lzma.c
index f727553..dbc464c 100644
--- a/src/lib/lzma.c
+++ b/src/lib/lzma.c
@@ -37,6 +37,8 @@
 	 * 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");

-- 
To view, visit https://review.coreboot.org/25222
To unsubscribe, or for help writing mail filters, visit https://review.coreboot.org/settings

Gerrit-Project: coreboot
Gerrit-Branch: master
Gerrit-MessageType: newchange
Gerrit-Change-Id: I336de417c7cd6f35cf84947fc4ae161c15bd93ef
Gerrit-Change-Number: 25222
Gerrit-PatchSet: 1
Gerrit-Owner: Patrick Rudolph <patrick.rudolph at 9elements.com>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.coreboot.org/pipermail/coreboot-gerrit/attachments/20180316/28aeced0/attachment.html>


More information about the coreboot-gerrit mailing list