It's been a while since I reported this bug, and it doesn't look like upstream is going to release a new version anytime soon—the last commit was 11 months ago. However, this is quite annoying when checking the status of e.g. Postgres processes (which include their status in their process name), so I took the liberty of adding the patch and creating a debdiff of it (which you'll find below my signature).
Kind regards, Willem Mulder diff -Nru htop-2.2.0/debian/patches/812-fix-process-name-updates-for-shorter-strings.patch htop-2.2.0/debian/patches/812-fix-process-name-updates-for-shorter-strings.patch --- htop-2.2.0/debian/patches/812-fix-process-name-updates-for-shorter-strings.patch 1970-01-01 01:00:00.000000000 +0100 +++ htop-2.2.0/debian/patches/812-fix-process-name-updates-for-shorter-strings.patch 2020-01-07 00:41:53.000000000 +0100 @@ -0,0 +1,24 @@ +From b9c0d6d87c5b0bf7baf81370de02c5f9b62ffb7a Mon Sep 17 00:00:00 2001 +From: Score_Under <seejay...@gmail.com> +Date: Tue, 10 Jul 2018 21:17:49 +0100 +Subject: [PATCH] Fix process name updates for shorter strings + +When a process name changes from a long string to a short string, +truncate instead of just overwriting the beginning. +--- + linux/LinuxProcessList.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/linux/LinuxProcessList.c b/linux/LinuxProcessList.c +index 2edd0425..27ead28a 100644 +--- a/linux/LinuxProcessList.c ++++ b/linux/LinuxProcessList.c +@@ -709,7 +709,7 @@ static bool LinuxProcessList_readCmdlineFile(Process* process, const char* dirna + } + command[lastChar + 1] = '\0'; + process->basenameOffset = tokenEnd; +- setCommand(process, command, lastChar); ++ setCommand(process, command, lastChar + 1); + + return true; + } diff -Nru htop-2.2.0/debian/patches/series htop-2.2.0/debian/patches/series --- htop-2.2.0/debian/patches/series 2018-04-26 20:59:57.000000000 +0200 +++ htop-2.2.0/debian/patches/series 2020-01-07 00:38:51.000000000 +0100 @@ -1,2 +1,3 @@ 780-fix-option-string.patch fix-linux-process.patch +812-fix-process-name-updates-for-shorter-strings.patch