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>
diff --git a/Marshal_ECDH_KeyGen.c b/Marshal_ECDH_KeyGen.c
index e81286b..0498342 100644
--- a/Marshal_ECDH_KeyGen.c
+++ b/Marshal_ECDH_KeyGen.c
@@ -42,6 +42,9 @@
   TPM_RC result = TPM_RC_SUCCESS;
   // Get request handles from request_handles array.
   target->keyHandle = request_handles[0];
+  if ((result == TPM_RC_SUCCESS) && *size) {
+    result = TPM_RC_SIZE;
+  }
   return result;
 }