]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
BUG/MINOR: cli: Fix a possible infinite loop in _getsocks()
authorChristopher Faulet <cfaulet@haproxy.com>
Thu, 6 Feb 2025 14:37:52 +0000 (15:37 +0100)
committerChristopher Faulet <cfaulet@haproxy.com>
Thu, 6 Feb 2025 14:44:21 +0000 (15:44 +0100)
In _getsocks() functuoin, when we failed to set the unix socket in
non-blocking mode, a goto to "out" label led to loop infinitly. To fix the
issue, we must only let the function exit.

This patch should be backported to all stable versions.

src/cli.c

index 63d6a3d55df0a12a1eb70a8569414cca33696cb7..4c21c124dc53f75c3a4ec401485640cb085144ac 100644 (file)
--- a/src/cli.c
+++ b/src/cli.c
@@ -2438,10 +2438,8 @@ static int _getsocks(char **args, char *payload, struct appctx *appctx, void *pr
        }
 
 out:
-       if (fd >= 0 && old_fcntl >= 0 && fcntl(fd, F_SETFL, old_fcntl) == -1) {
+       if (fd >= 0 && old_fcntl >= 0 && fcntl(fd, F_SETFL, old_fcntl) == -1)
                ha_warning("Cannot make the unix socket non-blocking\n");
-               goto out;
-       }
        applet_set_eoi(appctx);
        appctx->st0 = CLI_ST_END;
        free(cmsgbuf);