From e8aef70f033f1be17a5282874c493161a419ebc9 Mon Sep 17 00:00:00 2001 From: Bram Matthys Date: Wed, 5 Apr 2023 07:21:52 +0200 Subject: [PATCH] Fix crash on +f modes merging (SJOIN) due to the 6.1.0 +f/+F changes. Reported by Valware. --- src/modules/chanmodes/floodprot.c | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/src/modules/chanmodes/floodprot.c b/src/modules/chanmodes/floodprot.c index c65b0e4dc..04485a118 100644 --- a/src/modules/chanmodes/floodprot.c +++ b/src/modules/chanmodes/floodprot.c @@ -942,8 +942,14 @@ void *cmodef_dup_struct(void *r_in) /* We can copy most members in a lazy way... */ memcpy(w, r, sizeof(ChannelFloodProtection)); - /* ... except this one. */ - w->profile = raw_strdup(r->profile); + /* ... except this one. + * NOTE: can't use safe_strdup() here because + * w->profile = r->profile at this point due + * to the memcpy and safe_strdup() would free + * it (and thus both). + */ + if (r->profile) + w->profile = raw_strdup(r->profile); return (void *)w; }