From 181ef543dea6447d6347abae4fab92ee4324d0a8 Mon Sep 17 00:00:00 2001 From: PartialVolume Date: Wed, 1 Dec 2021 19:20:34 +0000 Subject: [PATCH] nwipe_log format specifier doesn't match variable. The format specifier didn't match the size of the variable that holds c2[i]->device_sector_size which is an int. This didn't appear to cause a problem with reporting in a 64 bit build. It does cause a problem in a 32 bit build displaying a very large & incorrect number for sector, block and device sizes. This doesn't cause any issues with the overall function, simply incorrect sector, block and device sizes in 32 bit builds as displayed in the nwipe log. I also changed the signed long long for c2[i]->device _size to a unsigned long long as there is little point in a negative device size. --- src/context.h | 2 +- src/nwipe.c | 2 +- src/version.c | 4 ++-- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/context.h b/src/context.h index d390be1..26e3432 100644 --- a/src/context.h +++ b/src/context.h @@ -93,7 +93,7 @@ typedef struct nwipe_context_t_ char* device_name; // The device file name. char device_name_without_path[100]; char gui_device_name[100]; - long long device_size; // The device size in bytes. + unsigned long long device_size; // The device size in bytes. char* device_size_text; // The device size in a more (human)readable format. char device_size_txt[NWIPE_DEVICE_SIZE_TXT_LENGTH]; // The device size in a more (human)readable format. char* device_model; // The model of the device. diff --git a/src/nwipe.c b/src/nwipe.c index 905c176..53d238d 100644 --- a/src/nwipe.c +++ b/src/nwipe.c @@ -445,7 +445,7 @@ int main( int argc, char** argv ) if( c2[i]->device_size == 0 ) { nwipe_log( NWIPE_LOG_ERROR, - "%s, sect/blk/dev %llu/%i/%llu", + "%s, sect/blk/dev %i/%i/%llu", c2[i]->device_name, c2[i]->device_sector_size, c2[i]->device_block_size, diff --git a/src/version.c b/src/version.c index fe59f25..86ef6fa 100644 --- a/src/version.c +++ b/src/version.c @@ -4,7 +4,7 @@ * used by configure to dynamically assign those values * to documentation files. */ -const char* version_string = "0.32.014"; +const char* version_string = "0.32.015"; const char* program_name = "nwipe"; const char* author_name = "Martijn van Brummelen"; const char* email_address = "git@brumit.nl"; @@ -14,4 +14,4 @@ Modifications to original dwipe Copyright Andy Beverley \n\ This is free software; see the source for copying conditions.\n\ There is NO warranty; not even for MERCHANTABILITY or FITNESS\n\ FOR A PARTICULAR PURPOSE.\n"; -const char* banner = "nwipe 0.32.014"; +const char* banner = "nwipe 0.32.015";