]> git.ipfire.org Git - thirdparty/freeradius-server.git/commitdiff
fix whitespace stripping that never executes
authorCatalina Pineros <catalina.pineros@inkbridge.io>
Thu, 12 Mar 2026 17:42:48 +0000 (13:42 -0400)
committerAlan T. DeKok <aland@freeradius.org>
Fri, 13 Mar 2026 11:57:16 +0000 (07:57 -0400)
buff[2][slen] is set to '/0', which is not a whitespace character, so we need to check buff[2][slen - 1] to actually remove trailing whitespace

src/lib/server/cf_file.c

index 98c54db982b2e17d44b2baffbf10055bf41b4ab8..55f398a4c51b8f138aaf33a6bbf87ffa8f8398a6 100644 (file)
@@ -1607,9 +1607,9 @@ static CONF_ITEM *process_if(cf_stack_t *stack)
        buff[2][slen] = '\0';
 
        while (slen > 0) {
-               if (!isspace((uint8_t) buff[2][slen])) break;
+               if (!isspace((uint8_t) buff[2][slen - 1])) break;
 
-               buff[2][slen] = '\0';
+               buff[2][slen - 1] = '\0';
                slen--;
        }