]> git.ipfire.org Git - thirdparty/suricata.git/commitdiff
unix-socket: return after closing on too long
authorPhilippe Antoine <pantoine@oisf.net>
Thu, 30 Oct 2025 21:08:28 +0000 (22:08 +0100)
committerVictor Julien <vjulien@oisf.net>
Tue, 4 Nov 2025 16:33:07 +0000 (17:33 +0100)
Avoids later use after free

Ticket: 8063

src/unix-manager.c

index 3d8d120bd3b2387d21dd3244361e3be75238d742..c058b7c4419b059c647d1e45f805f54bf51cfdd9 100644 (file)
@@ -554,6 +554,7 @@ static void UnixCommandRun(UnixCommand * this, UnixClient *client)
             SCLogError("Command server: client command is too long, "
                        "disconnect him.");
             UnixCommandClose(this, client->fd);
+            return;
         }
         buffer[ret] = 0;
     } else {
@@ -575,6 +576,7 @@ static void UnixCommandRun(UnixCommand * this, UnixClient *client)
                 SCLogInfo("Command server: client command is too long, "
                         "disconnect him.");
                 UnixCommandClose(this, client->fd);
+                return;
             }
             if (buffer[ret - 1] == '\n') {
                 buffer[ret-1] = 0;