From 72ffb85a27dae2626b5d2d5e042acdce2c47721e Mon Sep 17 00:00:00 2001 From: Michael Ortmann <41313082+michaelortmann@users.noreply.github.com> Date: Sat, 22 Jun 2024 02:19:46 +0200 Subject: [PATCH] Make .share filename unique --- src/mod/share.mod/share.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/mod/share.mod/share.c b/src/mod/share.mod/share.c index 9fc14891f..4837fa84e 100644 --- a/src/mod/share.mod/share.c +++ b/src/mod/share.mod/share.c @@ -2032,14 +2032,14 @@ static void finish_share(int idx) static void start_sending_users(int idx) { struct userrec *u; - char share_file[1024], s1[64]; + char r[9], share_file[PATH_MAX], s1[64], s[EGG_INET_ADDRSTRLEN]; int i = 1; struct chanuserrec *ch; struct chanset_t *cst; - char s[EGG_INET_ADDRSTRLEN]; - snprintf(share_file, sizeof share_file, ".share.%s.%" PRId64, dcc[idx].nick, - (int64_t) now); + make_rand_str_from_chars(r, (sizeof r) - 1, CHARSET_LOWER_ALPHA); + snprintf(share_file, sizeof share_file, ".share.%s.%" PRId64 ".%s", + dcc[idx].nick, (int64_t) now, r); if (dcc[idx].u.bot->uff_flags & UFF_OVERRIDE) { debug1("NOTE: Sharing aggressively with %s, overriding its local bots.", dcc[idx].nick);