Skip to content

Commit df3b675

Browse files
eriknyquistcalvinatintel
authored andcommitted
SerialFlash: enlarge chip ID buffer
SerialFlashChip::readID() writes up to 5 bytes into the buffer provided, but the caller only allocates 3 bytes. Increase buffer size to 5 bytes.
1 parent c27462c commit df3b675

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

libraries/SerialFlash/SerialFlashDirectory.cpp

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -310,7 +310,9 @@ bool SerialFlashChip::create(const char *filename, uint32_t length, uint32_t ali
310310
// last check, if enough space exists...
311311
len = strlen(filename);
312312
// TODO: check for enough string space for filename
313-
uint8_t id[3];
313+
314+
// 5 bytes, to allow for extra 2 bytes in Spansion device IDs
315+
uint8_t id[5];
314316
SerialFlash.readID(id);
315317
if (address + length > SerialFlash.capacity(id)) return false;
316318

0 commit comments

Comments
 (0)