]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
test: add a testcase that demonstrates a conflict of hashed filename
authorYu Watanabe <watanabe.yu+github@gmail.com>
Fri, 4 Jun 2021 13:16:02 +0000 (22:16 +0900)
committerYu Watanabe <watanabe.yu+github@gmail.com>
Fri, 4 Jun 2021 13:28:52 +0000 (22:28 +0900)
The commit e64943363a8dd8bd320c2b633478be8befd1af5c introduces hashed
path at the end of the filename. But we can easily generate the path
which conflicts another path. The issue will be fixed in later commit.

src/udev/test-udev-node.c

index fe3dd437d5c629d12dcd65590ed5dd5ec3caab17..d2e2285089375450cfaf48f6e7372ab4b87717c9 100644 (file)
@@ -33,6 +33,10 @@ static void test_udev_node_escape_path(void) {
         strcpy(b + sizeof(b) - 12, "N3YhcCqFeID");
 
         test_udev_node_escape_path_one(a, b);
+
+        strcpy(a + sizeof(a) - 12 - 9, "N3YhcCqFeID");
+
+        test_udev_node_escape_path_one(a, b); /* <-- Ouch. This will pass. Needs to be fixed. */
 }
 
 int main(int argc, char *argv[]) {