Avoid path traversal in disk writer.

Thanks to Stefan Vinck of Radically Open Security.
This commit is contained in:
Juliusz Chroboczek
2025-01-17 11:32:37 +01:00
parent 3e60248e54
commit 007009381b
2 changed files with 28 additions and 1 deletions
+16
View File
@@ -7,6 +7,22 @@ import (
"github.com/jech/galene/rtptime"
)
func TestSanitise(t *testing.T) {
tests := []struct{ a, b string }{
{"Alas", "Alas"},
{", poor Horatio", ", poor Horatio"},
{"I/knew\\him/well", "I-slash-knew-backslash-him-slash-well"},
}
for _, tt := range tests {
c := sanitise(tt.a)
if c != tt.b {
t.Errorf("sanitise(%v): got %v, expected %v",
tt.a, c, tt.b)
}
}
}
func TestAdjustOriginLocalNow(t *testing.T) {
now := time.Now()