Skip to content

Commit 25d1f08

Browse files
committed
prepare_listener: initialize sock to -1
Fixes a bug on the error path at the bad: label where it is assumed that sock is either a valid fd or -1. Found by the ZeroPath AI Security Engineer <https://zeropath.com>
1 parent 7eaa526 commit 25d1f08

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/exec_intercept.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -222,7 +222,7 @@ prepare_listener(struct intercept_closure *closure)
222222
{
223223
struct sockaddr_in sin4;
224224
socklen_t sin4_len = sizeof(sin4);
225-
int sock;
225+
int sock = -1;
226226
debug_decl(prepare_listener, SUDO_DEBUG_EXEC);
227227

228228
/* Generate a random token. */

0 commit comments

Comments
 (0)