diff options
author | Vadim Bendebury <vbendeb@chromium.org> | 2015-10-20 17:17:54 -0700 |
---|---|---|
committer | chrome-bot <chrome-bot@chromium.org> | 2015-10-21 01:17:57 +0000 |
commit | 3dfffca12cb483bee81b6f65b6aeed027204b8f1 (patch) | |
tree | 6b814017c454089e1c9e6e23a2b706c944bd19a8 /Marshal_PCR_Allocate.c | |
parent | 67fb16032ad9462343032236d5ae96ef90cf2499 (diff) | |
download | tpm2-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_PCR_Allocate.c')
-rw-r--r-- | Marshal_PCR_Allocate.c | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/Marshal_PCR_Allocate.c b/Marshal_PCR_Allocate.c index e42b352..0d9cd24 100644 --- a/Marshal_PCR_Allocate.c +++ b/Marshal_PCR_Allocate.c @@ -49,6 +49,9 @@ TPM_RC PCR_Allocate_In_Unmarshal(PCR_Allocate_In* target, if (result != TPM_RC_SUCCESS) { return result; } + if ((result == TPM_RC_SUCCESS) && *size) { + result = TPM_RC_SIZE; + } return result; } |