mirror of
https://dev.iopsys.eu/bbf/bbfdm.git
synced 2026-02-03 12:27:43 +01:00
Fix radio find logic from DE collector dump
This commit is contained in:
parent
09c6514c41
commit
94839155da
1 changed files with 8 additions and 3 deletions
|
|
@ -720,9 +720,14 @@ static json_object *find_radio_object(json_object *device_obj, const char *uniqu
|
|||
char mac[32] = {0};
|
||||
char *id = dmjson_get_value(radio_obj, 1, "ID");
|
||||
char *str = base64_decode(id);
|
||||
string_to_mac(str, DM_STRLEN(str), mac, sizeof(mac));
|
||||
if (DM_STRCMP(unique_key, mac) == 0)
|
||||
return radio_obj;
|
||||
|
||||
/* Cant use strlen on byte array that might genuinely include 0x00 */
|
||||
/* but to get 6 bytes, need 8 input BASE64 chars - check for that */
|
||||
if ((str != NULL) && (DM_STRLEN(id) == 8)) {
|
||||
string_to_mac(str, 6, mac, sizeof(mac));
|
||||
if (DM_STRCMP(unique_key, mac) == 0)
|
||||
return radio_obj;
|
||||
}
|
||||
}
|
||||
|
||||
return NULL;
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue