From e5b24f3a9bd38de249baa4b362b47b4848187c7e Mon Sep 17 00:00:00 2001 From: Paul Selkirk Date: Mon, 29 Oct 2018 16:43:40 -0400 Subject: 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 -- cgit v1.2.3