fix(device): Advance pointer past key prefix in parse_hex_field
strtoull was parsing "CPID:8015" instead of "8015", causing CPID and ECID to always return garbage. Now advances by strlen(key) before parsing the hex value. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
parent
74557ab64d
commit
5e582f8fdf
1 changed files with 2 additions and 2 deletions
|
|
@ -148,8 +148,8 @@ static int parse_hex_field(const char *serial, const char *key, uint64_t *out)
|
||||||
if (!p)
|
if (!p)
|
||||||
return -1;
|
return -1;
|
||||||
endptr = NULL;
|
endptr = NULL;
|
||||||
*out = strtoull(p, &endptr, 16);
|
*out = strtoull(p + strlen(key), &endptr, 16);
|
||||||
if (!endptr || endptr == p) {
|
if (!endptr || endptr == p + strlen(key)) {
|
||||||
log_warn("parse_hex_field: garbage value for key '%s'", key);
|
log_warn("parse_hex_field: garbage value for key '%s'", key);
|
||||||
*out = 0;
|
*out = 0;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue