mirror of
https://github.com/Telecominfraproject/OpenCellular.git
synced 2025-11-27 19:53:42 +00:00
VerifyKernelHeader() fills a KernelImage*
Rather than copying individual fields. More suitable for use in LoadKernel(). Added StatefulSkip(), so that fields in the input stream can be skipped more cleanly. Review URL: http://codereview.chromium.org/2327001
This commit is contained in:
@@ -12,6 +12,18 @@
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
void* StatefulSkip(MemcpyState* state, uint64_t len) {
|
||||
if (state->overrun)
|
||||
return NULL;
|
||||
if (len > state->remaining_len) {
|
||||
state->overrun = 1;
|
||||
return NULL;
|
||||
}
|
||||
state->remaining_buf += len;
|
||||
state->remaining_len -= len;
|
||||
return state; // have to return something non-NULL
|
||||
}
|
||||
|
||||
void* StatefulMemcpy(MemcpyState* state, void* dst,
|
||||
uint64_t len) {
|
||||
if (state->overrun)
|
||||
|
||||
Reference in New Issue
Block a user