Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(134)

Unified Diff: src/platform/vboot_reference/common/utility_stub.c

Issue 1519008: VBoot Reference: 18 Exabytes ought to be enough for everybody (Closed)
Patch Set: Use symbolic constants. Created 10 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | src/platform/vboot_reference/crypto/rsa_utility.c » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/platform/vboot_reference/common/utility_stub.c
diff --git a/src/platform/vboot_reference/common/utility_stub.c b/src/platform/vboot_reference/common/utility_stub.c
index 8d21897747ea026cbd5daaea9f7b45befdd40466..2d01226fb20837f237c80ca1ffdc3d28973867ba 100644
--- a/src/platform/vboot_reference/common/utility_stub.c
+++ b/src/platform/vboot_reference/common/utility_stub.c
@@ -47,9 +47,12 @@ int SafeMemcmp(const void* s1, const void* s2, size_t n) {
return match;
}
-void* StatefulMemcpy(MemcpyState* state, void* dst, int len) {
+void* StatefulMemcpy(MemcpyState* state, void* dst,
+ uint64_t len) {
+ if (state->overrun)
+ return NULL;
if (len > state->remaining_len) {
- state->remaining_len = -1;
+ state->overrun = 1;
return NULL;
}
Memcpy(dst, state->remaining_buf, len);
@@ -58,9 +61,12 @@ void* StatefulMemcpy(MemcpyState* state, void* dst, int len) {
return dst;
}
-const void* StatefulMemcpy_r(MemcpyState* state, const void* src, int len) {
+const void* StatefulMemcpy_r(MemcpyState* state, const void* src,
+ uint64_t len) {
+ if (state->overrun)
+ return NULL;
if (len > state->remaining_len) {
- state->remaining_len = -1;
+ state->overrun = 1;
return NULL;
}
Memcpy(state->remaining_buf, src, len);
« no previous file with comments | « no previous file | src/platform/vboot_reference/crypto/rsa_utility.c » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698