summaryrefslogtreecommitdiff
path: root/src/irmd/main.c
diff options
context:
space:
mode:
authorDimitri Staessens <[email protected]>2024-02-24 17:13:06 +0100
committerSander Vrijders <[email protected]>2024-02-26 08:59:15 +0100
commit12c3298335c48fcdd1551c1474f9afe07e9a067f (patch)
treeb6d847d56ac9cdf5ad8d5dfed0f791e19d4d0c55 /src/irmd/main.c
parent82aec24db65fd3bf06f60a8952c1b0b3dfd05ec4 (diff)
downloadouroboros-12c3298335c48fcdd1551c1474f9afe07e9a067f.tar.gz
ouroboros-12c3298335c48fcdd1551c1474f9afe07e9a067f.zip
irmd: Fix wrong hash length when getting ipcpd
The get_ipcpd_by_dst function was returning the hash length of the last IPCP in the list instead of the length of the actual hash. Signed-off-by: Dimitri Staessens <[email protected]> Signed-off-by: Sander Vrijders <[email protected]>
Diffstat (limited to 'src/irmd/main.c')
-rw-r--r--src/irmd/main.c5
1 files changed, 2 insertions, 3 deletions
diff --git a/src/irmd/main.c b/src/irmd/main.c
index 6e1a1262..bc13fa7c 100644
--- a/src/irmd/main.c
+++ b/src/irmd/main.c
@@ -970,9 +970,7 @@ static int get_ipcp_by_dst(const char * dst,
type = ipcps[i]->type;
algo = ipcps[i]->hash_algo;
- hash->len = hash_len(algo);
-
- tmp = ipcps[i]->pid;
+ tmp = ipcps[i]->pid;
enrolled = strcmp(ipcps[i]->layer, "Not enrolled.") != 0;
@@ -984,6 +982,7 @@ static int get_ipcp_by_dst(const char * dst,
if (err == 0 /* solution found */ || !enrolled)
continue;
+ hash->len = hash_len(algo);
hash->data = malloc(hash->len);
if (hash->data == NULL) {
log_warn("Failed to malloc hash for query.");