@@ -237,6 +237,8 @@ static int get_s64(struct lwm2m_input_context *in, int64_t *value)
237
237
{
238
238
ZCBOR_STATE_D (states , 0 , ICTX_BUF_R_PTR (in ), ICTX_BUF_R_LEFT_SZ (in ), 1 , 0 );
239
239
240
+ states -> constant_state -> enforce_canonical = false;
241
+
240
242
if (!zcbor_int64_decode (states , value )) {
241
243
LOG_WRN ("unable to decode a 64-bit integer value" );
242
244
return - EBADMSG ;
@@ -253,6 +255,8 @@ static int get_s32(struct lwm2m_input_context *in, int32_t *value)
253
255
{
254
256
ZCBOR_STATE_D (states , 0 , ICTX_BUF_R_PTR (in ), ICTX_BUF_R_LEFT_SZ (in ), 1 , 0 );
255
257
258
+ states -> constant_state -> enforce_canonical = false;
259
+
256
260
if (!zcbor_int32_decode (states , value )) {
257
261
LOG_WRN ("unable to decode a 32-bit integer value, err: %d" ,
258
262
states -> constant_state -> error );
@@ -270,6 +274,8 @@ static int get_float(struct lwm2m_input_context *in, double *value)
270
274
{
271
275
ZCBOR_STATE_D (states , 0 , ICTX_BUF_R_PTR (in ), ICTX_BUF_R_LEFT_SZ (in ), 1 , 0 );
272
276
277
+ states -> constant_state -> enforce_canonical = false;
278
+
273
279
if (!zcbor_float_decode (states , value )) {
274
280
LOG_ERR ("unable to decode a floating-point value" );
275
281
return - EBADMSG ;
@@ -289,6 +295,8 @@ static int get_string(struct lwm2m_input_context *in, uint8_t *value, size_t buf
289
295
290
296
ZCBOR_STATE_D (states , 0 , ICTX_BUF_R_PTR (in ), ICTX_BUF_R_LEFT_SZ (in ), 1 , 0 );
291
297
298
+ states -> constant_state -> enforce_canonical = false;
299
+
292
300
if (!zcbor_tstr_decode (states , & hndl )) {
293
301
LOG_WRN ("unable to decode a string" );
294
302
return - EBADMSG ;
@@ -318,6 +326,8 @@ static int get_time_string(struct lwm2m_input_context *in, int64_t *value)
318
326
319
327
ZCBOR_STATE_D (states , 0 , ICTX_BUF_R_PTR (in ), ICTX_BUF_R_LEFT_SZ (in ), 1 , 0 );
320
328
329
+ states -> constant_state -> enforce_canonical = false;
330
+
321
331
if (!zcbor_tstr_decode (states , & hndl )) {
322
332
return - EBADMSG ;
323
333
}
@@ -336,6 +346,8 @@ static int get_time_numerical(struct lwm2m_input_context *in, int64_t *value)
336
346
{
337
347
ZCBOR_STATE_D (states , 0 , ICTX_BUF_R_PTR (in ), ICTX_BUF_R_LEFT_SZ (in ), 1 , 0 );
338
348
349
+ states -> constant_state -> enforce_canonical = false;
350
+
339
351
if (!zcbor_int64_decode (states , value )) {
340
352
LOG_WRN ("unable to decode seconds since Epoch" );
341
353
return - EBADMSG ;
@@ -355,6 +367,8 @@ static int get_time(struct lwm2m_input_context *in, time_t *value)
355
367
356
368
ZCBOR_STATE_D (states , 0 , ICTX_BUF_R_PTR (in ), ICTX_BUF_R_LEFT_SZ (in ), 1 , 0 );
357
369
370
+ states -> constant_state -> enforce_canonical = false;
371
+
358
372
success = zcbor_tag_decode (states , & tag );
359
373
360
374
if (success ) {
@@ -405,6 +419,8 @@ static int get_bool(struct lwm2m_input_context *in, bool *value)
405
419
{
406
420
ZCBOR_STATE_D (states , 0 , ICTX_BUF_R_PTR (in ), ICTX_BUF_R_LEFT_SZ (in ), 1 , 0 );
407
421
422
+ states -> constant_state -> enforce_canonical = false;
423
+
408
424
if (!zcbor_bool_decode (states , value )) {
409
425
LOG_WRN ("unable to decode a boolean value" );
410
426
return - EBADMSG ;
@@ -425,6 +441,8 @@ static int get_opaque(struct lwm2m_input_context *in, uint8_t *value, size_t buf
425
441
426
442
ZCBOR_STATE_D (states , 1 , ICTX_BUF_R_PTR (in ), ICTX_BUF_R_LEFT_SZ (in ), 1 , 0 );
427
443
444
+ states -> constant_state -> enforce_canonical = false;
445
+
428
446
/* Get the CBOR header only on first read. */
429
447
if (opaque -> offset == 0 ) {
430
448
ret = zcbor_bstr_start_decode_fragment (states , & hndl );
0 commit comments