Better error for _EnterBstrWrapped on allocated (indef) strings (#221)
Better error for QCBORDecode_EnterBstrWrapped on allocated strings. Since indefinite-length strings are always allocated, this gives a better error for attempts to use this on indefinite-length strings.
The TODO: to make this work is closed out as it was decided not to support QCBORDecode_EnterBstrWrapped() on indefinite-length strings. To do so would require increasing the size of QCBORItem.
* Add limitations comment
---------
Co-authored-by: Laurence Lundblade <lgl@securitytheory.com>
diff --git a/src/qcbor_decode.c b/src/qcbor_decode.c
index 799fff2..56f15f7 100644
--- a/src/qcbor_decode.c
+++ b/src/qcbor_decode.c
@@ -4131,6 +4131,11 @@
return;
}
+ if(Item.uDataAlloc) {
+ pMe->uLastError = QCBOR_ERR_CANNOT_ENTER_ALLOCATED_STRING;
+ return;
+ }
+
pMe->uLastError = (uint8_t)QCBORDecode_Private_EnterBstrWrapped(pMe,
&Item,
uTagRequirement,