Skip to content

Commit

Permalink
rimage/toml_utils.c: stop ignoring errors in parse_uuid()
Browse files Browse the repository at this point in the history
assert() that sscanf returns the expected value.

Signed-off-by: Marc Herbert <[email protected]>
  • Loading branch information
marc-hb committed Oct 20, 2023
1 parent b6d34fb commit 653eed3
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions tools/rimage/src/toml_utils.c
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
#include <rimage/toml_utils.h>
#include <rimage/cavs/cavs_ext_manifest.h>

#include <assert.h>
#include <errno.h>
#include <string.h>
#include <stdlib.h>
Expand Down Expand Up @@ -294,8 +295,12 @@ void parse_uuid(char *buf, uint8_t *uuid)
struct uuid_t id;
uint32_t d[10];

const int parsed_uuid_fields =
sscanf(buf, "%08x-%04x-%04x-%02x%02x-%02x%02x%02x%02x%02x%02x", &id.d0, &d[0],
&d[1], &d[2], &d[3], &d[4], &d[5], &d[6], &d[7], &d[8], &d[9]);

assert(parsed_uuid_fields == 11);

id.d1 = (uint16_t)d[0];
id.d2 = (uint16_t)d[1];
id.d3 = (uint8_t)d[2];
Expand Down

0 comments on commit 653eed3

Please sign in to comment.