From: msizanoen1 Date: Wed, 1 Mar 2023 14:48:08 +0000 (+0700) Subject: test-escape: Add tests for escaping bogus UTF-8 sequences X-Git-Tag: v254-rc1~1131^2~1 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=582843ee37fb2de62321085dd3c2f4bfbdbad12e;p=thirdparty%2Fsystemd.git test-escape: Add tests for escaping bogus UTF-8 sequences --- diff --git a/src/test/test-escape.c b/src/test/test-escape.c index b1ab5bab188..f3dd579e56d 100644 --- a/src/test/test-escape.c +++ b/src/test/test-escape.c @@ -196,6 +196,10 @@ TEST(shell_maybe_quote) { test_shell_maybe_quote_one("głąb\002\003rząd", 0, "\"głąb\\002\\003rząd\""); test_shell_maybe_quote_one("głąb\002\003rząd", SHELL_ESCAPE_POSIX, "$'głąb\\002\\003rząd'"); + + /* Bogus UTF-8 strings */ + test_shell_maybe_quote_one("\250\350", 0, "\"\\250\\350\""); + test_shell_maybe_quote_one("\250\350", SHELL_ESCAPE_POSIX, "$'\\250\\350'"); } static void test_quote_command_line_one(char **argv, const char *expected) {