From 6bbb9b7ec0c9e138815b2e20efa4c7e141e6c733 Mon Sep 17 00:00:00 2001 From: HATAYAMA Daisuke Date: Fri, 13 Sep 2013 16:06:55 +0900 Subject: [PATCH 1/2] sadump: correct buffer size for GUID EFI text representation While GUID EFI text representaion needs 36 bytes, all the buffers for GUID EFI passed to guid_to_str() are of 33 bytes, due to which last three characters in GUID are not displayed now. This patch increases buffer size from 33 bytes to 36 bytes and make GUID fully visible. Signed-off-by: HATAYAMA Daisuke --- sadump.c | 8 +++++--- sadump.h | 2 ++ 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/sadump.c b/sadump.c index 93799bc..5af29ad 100644 --- a/sadump.c +++ b/sadump.c @@ -127,7 +127,8 @@ read_dump_header(char *file) uint32_t smram_cpu_state_size = 0; ulong bitmap_len, dumpable_bitmap_len; char *bitmap = NULL, *dumpable_bitmap = NULL, *page_buf = NULL; - char guid1[33], guid2[33]; + char guid1[SADUMP_EFI_GUID_TEXT_REPR_LEN+1]; + char guid2[SADUMP_EFI_GUID_TEXT_REPR_LEN+1]; sph = malloc(block_size); if (!sph) { @@ -468,7 +469,8 @@ add_disk(char *file) struct sadump_part_header *ph; struct sadump_diskset_data *this_disk; int diskid; - char guid1[33], guid2[33]; + char guid1[SADUMP_EFI_GUID_TEXT_REPR_LEN+1]; + char guid2[SADUMP_EFI_GUID_TEXT_REPR_LEN+1]; diskid = sd->sd_list_len - 1; this_disk = sd->sd_list[diskid]; @@ -905,7 +907,7 @@ int sadump_memory_dump(FILE *fp) struct sadump_header *sh; struct sadump_media_header *smh; int i, others; - char guid[33]; + char guid[SADUMP_EFI_GUID_TEXT_REPR_LEN+1]; fprintf(fp, "sadump_data: \n"); fprintf(fp, " filename: %s\n", sd->filename); diff --git a/sadump.h b/sadump.h index 29dce06..09e313e 100644 --- a/sadump.h +++ b/sadump.h @@ -41,6 +41,8 @@ typedef struct { uint8_t data4[8]; } efi_guid_t; +#define SADUMP_EFI_GUID_TEXT_REPR_LEN 36 + struct sadump_part_header { #define SADUMP_SIGNATURE1 0x75646173 #define SADUMP_SIGNATURE2 0x0000706d -- 1.8.3.1