From a54820ff0e1b74554c7f649e8386ee8c4ecd98f5 Mon Sep 17 00:00:00 2001 From: Garrett D'Amore Date: Thu, 14 Sep 2023 01:29:55 -0700 Subject: fixes #1675 undefined behavior in posix ipc_dialer_dial (This also affects TCP, and fixed there.) --- src/platform/posix/posix_ipcdial.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'src/platform/posix/posix_ipcdial.c') diff --git a/src/platform/posix/posix_ipcdial.c b/src/platform/posix/posix_ipcdial.c index 464179a0..6cbd7c17 100644 --- a/src/platform/posix/posix_ipcdial.c +++ b/src/platform/posix/posix_ipcdial.c @@ -1,5 +1,5 @@ // -// Copyright 2020 Staysail Systems, Inc. +// Copyright 2023 Staysail Systems, Inc. // Copyright 2018 Capitar IT Group BV // Copyright 2019 Devolutions // @@ -188,6 +188,8 @@ ipc_dialer_dial(void *arg, nni_aio *aio) // This arranges for the fd to be in non-blocking mode, and adds the // poll fd to the list. if ((rv = nni_posix_pfd_init(&pfd, fd)) != 0) { + // the error label unlocks this + nni_mtx_lock(&d->mtx); goto error; } -- cgit v1.2.3-70-g09d2