From a4af100ca846910c8abc4aa24b9d6a2d8a6d14f5 Mon Sep 17 00:00:00 2001 From: Bram Matthys Date: Mon, 3 Jan 2022 08:59:14 +0100 Subject: [PATCH] Memory isn't initialized to zero by dbuf_queue_init(), causing dbuf->length to be unitialized. This wasn't an actual problem until yesterday in UnrealIRCd code, since the whole client struct was initialized to zero, including client->local->sendQ(->length) etc. However, now we use the dbuf code elsewhere too (on the stack) and 3rd party modules can use it too, so fix this bug. --- src/dbuf.c | 1 + 1 file changed, 1 insertion(+) diff --git a/src/dbuf.c b/src/dbuf.c index 23786d5e4..b1ba1ab6e 100644 --- a/src/dbuf.c +++ b/src/dbuf.c @@ -58,6 +58,7 @@ static void dbuf_free(dbufbuf *ptr) void dbuf_queue_init(dbuf *dyn) { + memset(dyn, 0, sizeof(dbuf)); INIT_LIST_HEAD(&dyn->dbuf_list); }