[coreboot-gerrit] New patch to review for coreboot: lib/tpm2_marshaling: fix in correct buffer space semantics

Aaron Durbin (adurbin@chromium.org) gerrit at coreboot.org
Wed Mar 8 18:36:45 CET 2017


Aaron Durbin (adurbin at chromium.org) just uploaded a new patch set to gerrit, which you can find at https://review.coreboot.org/18678

-gerrit

commit 01a07330da1a0cbe6e4f1379e90e614cebfdfd30
Author: Aaron Durbin <adurbin at chromium.org>
Date:   Mon Mar 6 16:33:57 2017 -0600

    lib/tpm2_marshaling: fix in correct buffer space semantics
    
    marshal_blob() was setting an unsigned size (size_t) to a value
    of -1 when an error is determined. This is wrong for the current
    implementation of the code because the code assumes the buffer
    space gets set to 0. Setting an unsigned value to -1 effectively
    tells the library the buffer has unlimited amount of space.
    
    BUG=b:35775104
    
    Change-Id: I677a1fd7528bef3ea7420d0a8d0a290e9b15cea3
    Signed-off-by: Aaron Durbin <adurbin at chromium.org>
---
 src/lib/tpm2_marshaling.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/lib/tpm2_marshaling.c b/src/lib/tpm2_marshaling.c
index 38c8d2f..dd046d2 100644
--- a/src/lib/tpm2_marshaling.c
+++ b/src/lib/tpm2_marshaling.c
@@ -100,7 +100,7 @@ static void marshal_blob(void **buffer, void *blob,
 			 size_t blob_size, size_t *buffer_space)
 {
 	if (*buffer_space < blob_size) {
-		*buffer_space = -1;
+		*buffer_space = 0;
 		return;
 	}
 



More information about the coreboot-gerrit mailing list