[prev in list] [next in list] [prev in thread] [next in thread] 

List:       fwts-devel
Subject:    Re: [PATCH] uefi: uefidump: don't dump non-printable variable contents (LP: #1435346)
From:       Colin Ian King <colin.king () canonical ! com>
Date:       2015-03-27 3:30:24
Message-ID: 5514CED0.7080301 () canonical ! com
[Download RAW message or body]

On 26/03/15 20:27, ivanhu wrote:
> This patch had already been sent and got 2 acks, any differences from
> the last one?

Oops, sorry, I somehow sent that out by mistake. Please ignore this.

Colin
> 
> On 2015年03月27日 11:06, Colin King wrote:
>> From: Colin Ian King <colin.king@canonical.com>
>>
>> Do a hex dump of kernel dump UEFI vars if the contents is
>> not printable ASCII.
>>
>> Signed-off-by: Colin Ian King <colin.king@canonical.com>
>> ---
>>   src/uefi/uefidump/uefidump.c | 32 ++++++++++++++++++++++++--------
>>   1 file changed, 24 insertions(+), 8 deletions(-)
>>
>> diff --git a/src/uefi/uefidump/uefidump.c b/src/uefi/uefidump/uefidump.c
>> index 8421e72..014abe2 100644
>> --- a/src/uefi/uefidump/uefidump.c
>> +++ b/src/uefi/uefidump/uefidump.c
>> @@ -768,19 +768,35 @@ static void
>> uefidump_info_dump_type0(fwts_framework *fw, fwts_uefi_var *var)
>>   {
>>       char *ptr = (char*)var->data;
>>       size_t len = var->datalen;
>> +    bool printable = true;
>>         while (len && *ptr) {
>> -        char *start = ptr;
>> -        while (len && *ptr && *ptr != '\n') {
>> -            ptr++;
>> -            len--;
>> +        if (!(isspace(*ptr) || isprint(*ptr))) {
>> +            printable = false;
>> +            break;
>>           }
>> +        ptr++;
>> +        len--;
>> +    }
>>   -        if (*ptr == '\n') {
>> -            *ptr++ = '\0';
>> -            len--;
>> -            fwts_log_info_verbatum(fw, "  KLog: %s.", start);
>> +    ptr = (char*)var->data;
>> +    len = var->datalen;
>> +
>> +    if (printable) {
>> +        while (len && *ptr) {
>> +            char *start = ptr;
>> +            while (len && *ptr && *ptr != '\n') {
>> +                ptr++;
>> +                len--;
>> +            }
>> +            if (*ptr == '\n') {
>> +                *ptr++ = '\0';
>> +                len--;
>> +                fwts_log_info_verbatum(fw, "  KLog: %s.", start);
>> +            }
>>           }
>> +    } else {
>> +        uefidump_var_hexdump(fw, var);
>>       }
>>   }
>>   
> 
1

-- 
fwts-devel mailing list
fwts-devel@lists.ubuntu.com
Modify settings or unsubscribe at: https://lists.ubuntu.com/mailman/listinfo/fwts-devel

[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic