From 602ff5e8b56cfa9733f2f4bfed97d4764247a1ba Mon Sep 17 00:00:00 2001 From: Roberto Puzzanghera <73385325+sagredo-dev@users.noreply.github.com> Date: Thu, 18 Jan 2024 16:21:14 +0100 Subject: [PATCH] fixed a buffer overflow in domain.c --- domain.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/domain.c b/domain.c index a042c9f..a583578 100644 --- a/domain.c +++ b/domain.c @@ -499,9 +499,9 @@ void mod_domain() void post_domain_info(char *domain) { char Dir[156]; - char cuid[10]; - char cgid[10]; - char cusers[10]; + char cuid[11]; + char cgid[11]; + char cusers[11]; char qconvert[11]; uid_t uid; gid_t gid; @@ -519,16 +519,16 @@ void post_domain_info(char *domain) global_par("DN", domain); global_par("DD", Dir); - snprintf(cuid, sizeof(cuid)+1, "%lu", (long unsigned)uid); + snprintf(cuid, sizeof(cuid), "%lu", (long unsigned)uid); global_par("DU", cuid); - snprintf(cgid, sizeof(cgid)+1, "%lu", (long unsigned)gid); + snprintf(cgid, sizeof(cgid), "%lu", (long unsigned)gid); global_par("DG", cgid); open_big_dir(domain, uid, gid); close_big_dir(domain,uid,gid); - snprintf(cusers, sizeof(cusers)+1, "%lu", (long unsigned)vdir.cur_users); + snprintf(cusers, sizeof(cusers), "%lu", (long unsigned)vdir.cur_users); global_par("DS", cusers); vpw = vauth_getpw("postmaster", domain);