[Cryptech-Commits] [sw/libhal] branch master updated: Sigh, add8e03 botched handling of 0-length hal_xdr_encode_fixed_opaque requests.

git at cryptech.is git at cryptech.is
Mon Oct 29 20:46:36 UTC 2018


This is an automated email from the git hooks/post-receive script.

paul at psgd.org pushed a commit to branch master
in repository sw/libhal.

The following commit(s) were added to refs/heads/master by this push:
     new e5b24f3  Sigh, add8e03 botched handling of 0-length hal_xdr_encode_fixed_opaque requests.
e5b24f3 is described below

commit e5b24f3a9bd38de249baa4b362b47b4848187c7e
Author: Paul Selkirk <paul at psgd.org>
AuthorDate: Mon Oct 29 16:43:40 2018 -0400

    Sigh, add8e03 botched handling of 0-length hal_xdr_encode_fixed_opaque requests.
    
    It's an edge case, but it's supported, and it's used in a few places.
---
 xdr.c | 5 +----
 1 file changed, 1 insertion(+), 4 deletions(-)

diff --git a/xdr.c b/xdr.c
index 9df5f49..2b42be9 100644
--- a/xdr.c
+++ b/xdr.c
@@ -92,10 +92,7 @@ hal_error_t hal_xdr_decode_int(const uint8_t ** const inbuf, const uint8_t * con
 hal_error_t hal_xdr_encode_fixed_opaque(uint8_t ** const outbuf, const uint8_t * const limit, const uint8_t * const value, const size_t len)
 {
     /* arg checks */
-    hal_assert(outbuf != NULL && *outbuf != NULL && limit != NULL && limit >= *outbuf && value != NULL);
-
-    if (len == 0)
-        return HAL_OK;
+    hal_assert(outbuf != NULL && *outbuf != NULL && limit != NULL && limit >= *outbuf && (value != NULL || len == 0));
 
     /* buffer overflow check */
     /* We need to explicitly check (len > 0xfffffffc) because padding will

-- 
To stop receiving notification emails like this one, please contact
the administrator of this repository.


More information about the Commits mailing list