Whamcloud - gitweb
e2fsck: handle invalid percent expansions in the log filename
authorTheodore Ts'o <tytso@mit.edu>
Thu, 11 Aug 2022 02:48:13 +0000 (22:48 -0400)
committerTheodore Ts'o <tytso@mit.edu>
Thu, 11 Aug 2022 02:48:13 +0000 (22:48 -0400)
Add a missing default: case when expanding percent expansions in the
log file specified in /etc/e2fsck.conf.

Addresses-Coverity-Bug: 1500757
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
e2fsck/logfile.c

index 7bdeae1..9d79eed 100644 (file)
@@ -155,6 +155,9 @@ static void expand_percent_expression(e2fsck_t ctx, char ch,
        case 'Y':
                sprintf(buf, "%d", tm->tm_year + 1900);
                break;
+       default:
+               sprintf(buf, "%%%c", ch);
+               break;
        }
        append_string(s, buf, 0);
 }