aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPaul Selkirk <paul@psgd.org>2018-10-29 16:43:40 -0400
committerPaul Selkirk <paul@psgd.org>2018-10-29 16:44:26 -0400
commite5b24f3a9bd38de249baa4b362b47b4848187c7e (patch)
tree62e41abd23d7f467bf5b6b1927bd5ead7e4f3d5a
parent4eebeee153bfc52d562f1f01599111a67ddb7efd (diff)
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.
-rw-r--r--xdr.c5
1 files changed, 1 insertions, 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