containsNulByte checks if a string contains a NUL byte, either as a literal \x00 or URL-encoded as %00.
(s string)
| 58 | // containsNulByte checks if a string contains a NUL byte, either as a literal \x00 |
| 59 | // or URL-encoded as %00. |
| 60 | func containsNulByte(s string) bool { |
| 61 | // Check for literal NUL byte |
| 62 | if strings.ContainsRune(s, '\x00') { |
| 63 | return true |
| 64 | } |
| 65 | // Check for URL-encoded NUL byte (%00) |
| 66 | // Using Contains directly since %00 has no case variation (both hex digits are 0) |
| 67 | return strings.Contains(s, "%00") |
| 68 | } |
| 69 | |
| 70 | // TrailingSlashMiddleware redirects requests with trailing slashes to their canonical form |
| 71 | func TrailingSlashMiddleware(next http.Handler) http.Handler { |
no outgoing calls
no test coverage detected
searching dependent graphs…