Skip to content

Commit 5a9dae7

Browse files
Merge tag 'v0.4.2' into dev
TinyCBOR release 0.4.2 This is a bugfix release. Important bugs fixed in this release: - Fixed builds against a static cJSON - Fixed MSVC builds - Fixed builds on freestanding C implementation (no FILE* API) - Fixed the return value of cbor_encoder_close_container when a previous OOM condition had been detected - Fixed the build in strict C89 mode (no C99 extensions) Signed-off-by: Thiago Macieira <[email protected]>
2 parents 4bd38cf + f945701 commit 5a9dae7

File tree

2 files changed

+4
-1
lines changed

2 files changed

+4
-1
lines changed

src/cborencoder.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -531,6 +531,8 @@ CborError cbor_encoder_close_container(CborEncoder *encoder, const CborEncoder *
531531
encoder->end = containerEncoder->end;
532532
if (containerEncoder->flags & CborIteratorFlag_UnknownLength)
533533
return append_byte_to_buffer(encoder, BreakByte);
534+
if (encoder->end)
535+
return CborErrorOutOfMemory; /* keep the state */
534536
return CborNoError;
535537
}
536538

tools/json2cbor/json2cbor.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -149,12 +149,13 @@ uint8_t *decode_base64url(const char *string, size_t *len)
149149

150150
uint8_t *decode_base16(const char *string, size_t *len)
151151
{
152+
size_t i;
152153
*len = strlen(string) / 2;
153154
uint8_t *buffer = malloc(*len);
154155
if (buffer == NULL)
155156
return NULL;
156157

157-
for (size_t i = 0; i < *len; ++i) {
158+
for (i = 0; i < *len; ++i) {
158159
char c = string[i * 2];
159160
if (c >= '0' && c <= '9') {
160161
buffer[i] = (c - '0') << 4;

0 commit comments

Comments
 (0)