]> xenbits.xensource.com Git - osstest/seabios.git/commitdiff
tcgbios: Fix the vendorInfoSize to be of type u8
authorStefan Berger <stefanb@linux.vnet.ibm.com>
Mon, 30 Mar 2020 11:55:56 +0000 (07:55 -0400)
committerKevin O'Connor <kevin@koconnor.net>
Sun, 19 Apr 2020 15:35:34 +0000 (11:35 -0400)
The vendorInfoSize is a u8 rather than a u32.

Signed-off-by: Stefan Berger <stefanb@linux.ibm.com>
Reviewed-by: Marc-André Lureau <marcandre.lureau@redhat.com>
src/tcgbios.c

index cc3a51f213487baba55fc998eac05aabbbed3e13..6a3a613ded723ef08e1624b6fb4552ec4fc97d1c 100644 (file)
@@ -287,7 +287,7 @@ tpm20_write_EfiSpecIdEventStruct(void)
 
         int event_size = offsetof(struct TCG_EfiSpecIdEventStruct
                                   , digestSizes[count+1]);
-        if (event_size > sizeof(event) - sizeof(u32)) {
+        if (event_size > sizeof(event) - sizeof(u8)) {
             dprintf(DEBUG_tcg, "EfiSpecIdEventStruct pad too small\n");
             return -1;
         }
@@ -307,7 +307,7 @@ tpm20_write_EfiSpecIdEventStruct(void)
     event.hdr.numberOfAlgorithms = numAlgs;
     int event_size = offsetof(struct TCG_EfiSpecIdEventStruct
                               , digestSizes[numAlgs]);
-    u32 *vendorInfoSize = (void*)&event + event_size;
+    u8 *vendorInfoSize = (void*)&event + event_size;
     *vendorInfoSize = 0;
     event_size += sizeof(*vendorInfoSize);