mirror of
https://github.com/TomHarte/CLK.git
synced 2025-01-11 08:30:55 +00:00
Enforce string-length requirement.
This commit is contained in:
parent
0433db0370
commit
28572d4392
@ -12,9 +12,13 @@ using namespace Storage::Disk;
|
||||
|
||||
namespace {
|
||||
|
||||
constexpr uint32_t block(const char *src) {
|
||||
static_assert(sizeof(int) >= sizeof(uint32_t));
|
||||
return uint32_t((src[0] << 24) | (src[1] << 16) | (src[2] << 8) | src[3]);
|
||||
constexpr uint32_t block(const char (& src)[5]) {
|
||||
return uint32_t(
|
||||
(uint32_t(src[0]) << 24) |
|
||||
(uint32_t(src[1]) << 16) |
|
||||
(uint32_t(src[2]) << 8) |
|
||||
uint32_t(src[3])
|
||||
);
|
||||
}
|
||||
|
||||
}
|
||||
@ -92,6 +96,9 @@ IPF::IPF(const std::string &file_name) : file_(file_name) {
|
||||
// Ignore: disk number, creator ID, reserved area.
|
||||
} break;
|
||||
|
||||
case block("IMGE"):
|
||||
break;
|
||||
|
||||
case block("DATA"): {
|
||||
length += file_.get32be();
|
||||
printf("Handling DATA block at %ld of length %d\n", start_of_block, length);
|
||||
|
Loading…
x
Reference in New Issue
Block a user