History

ihex: Check if zero-length record is at the end of the blob

When verifying the validity of IHEX file we need to make sure that zero-length record we found is located at the end of the file. Not doing that could result in an invalid file with a bogus zero-length in the middle short-circuiting the check and being reported as valid.

Andrey Smirnov committed 7 years ago

Commit 5158c361 parent 8092e791 file · +1 −1Browse files

Showing the changes to include/linux (1 of 1 file). Show all

Unified · Split

include/linux/ihex.h+1−1
@@ -49,7 +49,7 @@ static inline int ihex_validate_fw(const struct firmware *fw) · 48 unmodified lines
4949
5050 for (; rec <= end; rec = __ihex_next_binrec(rec)) {
5151 /* Zero length marks end of records */
52− if (!be16_to_cpu(rec->len))
52+ if (rec == end && !be16_to_cpu(rec->len))
5353 return 0;
5454 }
5555 return -EINVAL;

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t