From 7e96dc050a33f522dca8357b0767c6e1a20a416c Mon Sep 17 00:00:00 2001 From: Iurii Egorov Date: Fri, 6 Sep 2024 15:26:39 +0300 Subject: [PATCH] Auth notifications for unknown peers --- contrib/peer-approver/notification-listener.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/contrib/peer-approver/notification-listener.c b/contrib/peer-approver/notification-listener.c index 8376ed2..b1c3a94 100644 --- a/contrib/peer-approver/notification-listener.c +++ b/contrib/peer-approver/notification-listener.c @@ -116,10 +116,10 @@ static int get_endpoint(struct nlattr *peer[], char **endpoint_ip) static int run_callback(char *ifname, char *pubkey, char *endpoint_ip, bool advanced_security) { - char** new_argv = malloc((cb_argc + 1) * sizeof *new_argv); + char** new_argv = malloc((cb_argc + 2) * sizeof *new_argv); - for (int i = 2; i < cb_argc - 2; i++) { - new_argv[i - 2] = cb_argv[i]; + for (int i = 2; i < cb_argc - 3; i++) { + new_argv[i - 1] = cb_argv[i]; } new_argv[cb_argc - 4] = ifname; new_argv[cb_argc - 3] = pubkey; @@ -189,7 +189,7 @@ int main(int argc, char *argv[]) cleanup_and_exit(EXIT_FAILURE); } - cb_argc = argc + 2; + cb_argc = argc + 3; cb_argv = argv; signal(SIGTERM, signal_handler);