Skip to content

Commit 7bf89d6

Browse files
committed
pflash: fix buffer overflow: fl_total_size uint32_t not uint64_t
This ends up being harmless bug due to memory layout. $ ./pflash -F ~/op-build/output/images/firestone.pnor -i ==31829==ERROR: AddressSanitizer: global-buffer-overflow on address 0x00000062f0 80 at pc 0x410226 bp 0x7ffedba9c950 sp 0x7ffedba9c948 WRITE of size 8 at 0x00000062f080 thread T0 #0 0x410225 in file_get_info (/home/stewart/skiboot/external/pflash/pflash+0 x410225) #1 0x40d832 in blocklevel_get_info (/home/stewart/skiboot/external/pflash/pf lash+0x40d832) #2 0x401f0c in main (/home/stewart/skiboot/external/pflash/pflash+0x401f0c) open-power#3 0x7fc77439ab44 in __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x21 b44) open-power#4 0x403884 (/home/stewart/skiboot/external/pflash/pflash+0x403884) Signed-off-by: Stewart Smith <[email protected]>
1 parent 0f1c75d commit 7bf89d6

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

external/pflash/pflash.c

+2-1
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,8 @@ static uint8_t file_buf[FILE_BUF_SIZE] __aligned(0x1000);
5353

5454
static struct blocklevel_device *bl;
5555
static struct ffs_handle *ffsh;
56-
static uint32_t fl_total_size, fl_erase_granule;
56+
static uint64_t fl_total_size;
57+
static uint32_t fl_erase_granule;
5758
static const char *fl_name;
5859
static int32_t ffs_index = -1;
5960

0 commit comments

Comments
 (0)