# Add test to ensure the BatBadBut mitigation handles trailing \`\.\` and space safely · gitcafe/zig

[View on GitCafe](https://git.cafe/gitcafe/zig/commit/63014d3819423e8fd0990b9dfedb5eba921cb9e6)

Repository: [gitcafe/zig](https://git.cafe/gitcafe/zig)

Visibility: public

Requested revision: 63014d3819423e8fd0990b9dfedb5eba921cb9e6

Requested commit: 63014d3819423e8fd0990b9dfedb5eba921cb9e6

Commit: 63014d3819423e8fd0990b9dfedb5eba921cb9e6

Tree: 3802496b0778b7aaccb5fca2b2485a259e35d4df

Author: Ryan Liptak

Committer: Alex Rønne Petersen

## Message

```
Add test to ensure the BatBadBut mitigation handles trailing `.` and space safely

Context:
- https://blog.rust-lang.org/2024/09/04/cve-2024-43402.html
- https://github.com/rust-lang/rust/pull/129962

Note that the Rust test case for this checks that it executes the batch file successfully with the proper mitigation in place, while the Zig test case expects a FileNotFound error. This is because of a PATHEXT optimization that Zig does, and that Rust doesn't do because Rust doesn't do PATHEXT appending (it only appends .exe specifically). See the added comment for more details.

```

## Parents

- [2210c4c3604522ad0b07e15bc2a2d050923161c5](https://git.cafe/gitcafe/zig/commit/2210c4c3604522ad0b07e15bc2a2d050923161c5?format=markdown)

[Source at this commit](https://git.cafe/gitcafe/zig/tree/63014d3819423e8fd0990b9dfedb5eba921cb9e6?format=markdown)
