aboutsummaryrefslogtreecommitdiff
path: root/Marshal_ContextSave.c
diff options
context:
space:
mode:
authorVadim Bendebury <vbendeb@chromium.org>2015-10-20 17:17:54 -0700
committerchrome-bot <chrome-bot@chromium.org>2015-10-21 01:17:57 +0000
commit3dfffca12cb483bee81b6f65b6aeed027204b8f1 (patch)
tree6b814017c454089e1c9e6e23a2b706c944bd19a8 /Marshal_ContextSave.c
parent67fb16032ad9462343032236d5ae96ef90cf2499 (diff)
downloadtpm2-3dfffca12cb483bee81b6f65b6aeed027204b8f1.tar.gz
report error if input buffer is larger than expected
Let's make the implementation exact and always return TPM_RC_SIZE if unmarshaling returns success but there are some leftover data. BUG=chrome-os-partner:43025 TEST=fixed test is described in https://goo.gl/kQnud0, all previously passing tests still succeed Change-Id: I05f9c86d4a2a93bc5cdf73d4e743d56c3d53bdaa Signed-off-by: Vadim Bendebury <vbendeb@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/307602 Reviewed-by: Utkarsh Sanghi <usanghi@chromium.org>
Diffstat (limited to 'Marshal_ContextSave.c')
-rw-r--r--Marshal_ContextSave.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/Marshal_ContextSave.c b/Marshal_ContextSave.c
index 06a3e69..00ec8dd 100644
--- a/Marshal_ContextSave.c
+++ b/Marshal_ContextSave.c
@@ -41,6 +41,9 @@ TPM_RC ContextSave_In_Unmarshal(ContextSave_In* target,
TPM_RC result = TPM_RC_SUCCESS;
// Get request handles from request_handles array.
target->saveHandle = request_handles[0];
+ if ((result == TPM_RC_SUCCESS) && *size) {
+ result = TPM_RC_SIZE;
+ }
return result;
}