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:
tr4m0ryp 2026-04-05 03:51:26 +02:00
parent 74557ab64d
commit 5e582f8fdf

View file

@ -148,8 +148,8 @@ static int parse_hex_field(const char *serial, const char *key, uint64_t *out)
if (!p)
return -1;
endptr = NULL;
*out = strtoull(p, &endptr, 16);
if (!endptr || endptr == p) {
*out = strtoull(p + strlen(key), &endptr, 16);
if (!endptr || endptr == p + strlen(key)) {
log_warn("parse_hex_field: garbage value for key '%s'", key);
*out = 0;
}