From 5caddf52c853877d3075802ec9f21ed8ac085308 Mon Sep 17 00:00:00 2001 From: Thomas Mannfred Carlsson Date: Fri, 6 Feb 2026 22:24:28 +0200 Subject: [PATCH 1/3] Remove trailing whitespace in USERHOST --- modules/m_userhost.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/modules/m_userhost.c b/modules/m_userhost.c index 773561b5..c42c69b3 100644 --- a/modules/m_userhost.c +++ b/modules/m_userhost.c @@ -95,6 +95,13 @@ m_userhost(struct Client *client_p, struct Client *source_p, int parc, const cha } } + if(response[0] != '\0') + { + size_t len = strlen(response); + + if(len > 0 && response[len - 1] == ' ') + response[len - 1] = '\0'; + } sendto_one_numeric(source_p, s_RPL(RPL_USERHOST), response); return 0; } From 5dea01f75976fd5288d00dad88e8261de822a874 Mon Sep 17 00:00:00 2001 From: Aaron Sethman Date: Fri, 6 Feb 2026 15:29:56 -0500 Subject: [PATCH 2/3] do not code at 4am --- libratbox/include/rb_tools.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libratbox/include/rb_tools.h b/libratbox/include/rb_tools.h index fa813243..f30e0c32 100644 --- a/libratbox/include/rb_tools.h +++ b/libratbox/include/rb_tools.h @@ -116,7 +116,7 @@ rb_strndup(const char *x, size_t y) if(rb_unlikely(ret == NULL)) rb_outofmemory(); ret[len] = '\0'; - return memcpy(x, y, len); + return memcpy(ret, y, len); #else ret = strndup(x, y); if(rb_unlikely(ret == NULL)) From c7a3aeefc5a4ccffe44a68b2e0e795f5d03fff89 Mon Sep 17 00:00:00 2001 From: Thomas Mannfred Carlsson Date: Fri, 6 Feb 2026 22:39:27 +0200 Subject: [PATCH 3/3] Do not add trailing whitespace in USERHOST --- modules/m_userhost.c | 13 ++++--------- 1 file changed, 4 insertions(+), 9 deletions(-) diff --git a/modules/m_userhost.c b/modules/m_userhost.c index c42c69b3..793a21c1 100644 --- a/modules/m_userhost.c +++ b/modules/m_userhost.c @@ -70,6 +70,8 @@ m_userhost(struct Client *client_p, struct Client *source_p, int parc, const cha if((target_p = find_person(parv[i])) != NULL) { + if(!EmptyString(response)) + rb_strlcat(response, " ", sizeof(response)); /* * Show real IP for USERHOST on yourself. * This is needed for things like mIRC, which do a server-based @@ -78,7 +80,7 @@ m_userhost(struct Client *client_p, struct Client *source_p, int parc, const cha */ if(MyClient(target_p) && (target_p == source_p)) { - rb_snprintf_append(response, sizeof(response), "%s%s=%c%s@%s ", + rb_snprintf_append(response, sizeof(response), "%s%s=%c%s@%s", target_p->name, IsOper(target_p) ? "*" : "", (target_p->user->away) ? '-' : '+', @@ -86,7 +88,7 @@ m_userhost(struct Client *client_p, struct Client *source_p, int parc, const cha } else { - rb_snprintf_append(response, sizeof(response), "%s%s=%c%s@%s ", + rb_snprintf_append(response, sizeof(response), "%s%s=%c%s@%s", target_p->name, IsOper(target_p) ? "*" : "", (target_p->user->away) ? '-' : '+', @@ -95,13 +97,6 @@ m_userhost(struct Client *client_p, struct Client *source_p, int parc, const cha } } - if(response[0] != '\0') - { - size_t len = strlen(response); - - if(len > 0 && response[len - 1] == ' ') - response[len - 1] = '\0'; - } sendto_one_numeric(source_p, s_RPL(RPL_USERHOST), response); return 0; }