fix: out of bounds index when rewriting websocket headers

This commit is contained in:
Anthony Rubick
2025-08-01 02:12:50 -07:00
parent 4e32f31f0a
commit bd5d225a94
2 changed files with 8 additions and 0 deletions

View File

@@ -75,5 +75,9 @@ func SplitUpDownStreamHeaders(rewriteOptions *HeaderRewriteOptions) ([][]string,
downstreamHeaderCounter++
}
// Slice the arrays to only include the filled portions to prevent nil slice access
upstreamHeaders = upstreamHeaders[:upstreamHeaderCounter]
downstreamHeaders = downstreamHeaders[:downstreamHeaderCounter]
return upstreamHeaders, downstreamHeaders
}