From d364c76aa071585acbc29a30383604a1e7d029d4 Mon Sep 17 00:00:00 2001 From: Vinicius Costa Gomes Date: Wed, 18 Jan 2012 20:13:30 -0300 Subject: [PATCH] Use the helper function to convert a string to a binary buffer When loading Link Keys from storage we are able to re-use the function that was introduced earlier for the LTK case. --- src/adapter.c | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-) diff --git a/src/adapter.c b/src/adapter.c index 6e8552b33..d5075db74 100644 --- a/src/adapter.c +++ b/src/adapter.c @@ -1819,7 +1819,6 @@ static struct link_key_info *get_key_info(const char *addr, const char *value) struct link_key_info *info; char tmp[3]; long int l; - int i; if (strlen(value) < 36) { error("Unexpectedly short (%zu) link key line", strlen(value)); @@ -1830,12 +1829,7 @@ static struct link_key_info *get_key_info(const char *addr, const char *value) str2ba(addr, &info->bdaddr); - memset(tmp, 0, sizeof(tmp)); - - for (i = 0; i < 16; i++) { - memcpy(tmp, value + (i * 2), 2); - info->key[i] = (uint8_t) strtol(tmp, NULL, 16); - } + str2buf(value, info->key, sizeof(info->key)); memcpy(tmp, value + 33, 2); info->type = (uint8_t) strtol(tmp, NULL, 10); -- 2.47.3