]> git.ipfire.org Git - thirdparty/util-linux.git/commitdiff
wall: fix escape sequence Injection [CVE-2024-28085]
authorKarel Zak <kzak@redhat.com>
Thu, 21 Mar 2024 10:16:20 +0000 (11:16 +0100)
committerKarel Zak <kzak@redhat.com>
Mon, 1 Apr 2024 09:50:51 +0000 (11:50 +0200)
Let's use for all cases the same output function.

Reported-by: Skyler Ferrante <sjf5462@rit.edu>
Signed-off-by: Karel Zak <kzak@redhat.com>
(cherry picked from commit 404b0781f52f7c045ca811b2dceec526408ac253)

term-utils/wall.c

index 377db451837174951b9bec016497d60fbb0a32ee..1e7e9abc42859527375acae593a0781beb71738b 100644 (file)
@@ -328,7 +328,7 @@ static char *makemsg(char *fname, char **mvec, int mvecsz,
                int i;
 
                for (i = 0; i < mvecsz; i++) {
-                       fputs(mvec[i], fs);
+                       fputs_careful(mvec[i], fs, '^', true, TERM_WIDTH);
                        if (i < mvecsz - 1)
                                fputc(' ', fs);
                }