aboutsummaryrefslogtreecommitdiff
path: root/vendor/github.com/gorilla/websocket/mask.go
diff options
context:
space:
mode:
authorJordan <me@jordan.im>2023-12-16 17:41:01 -0700
committerJordan <me@jordan.im>2023-12-16 17:41:01 -0700
commit7ecc048ae012a631bc3f0dcbd62f6190384ea0cd (patch)
treef8dd09feb67af740fb92d13c458e602f9bee8d45 /vendor/github.com/gorilla/websocket/mask.go
parenta3dac1a28fdc9e42d85c4686858c64597cf1a15b (diff)
downloadkeep-main.tar.gz
keep-main.zip
misc: go get -u; go mod tidy; go mod vendorHEADmain
Diffstat (limited to 'vendor/github.com/gorilla/websocket/mask.go')
-rw-r--r--vendor/github.com/gorilla/websocket/mask.go4
1 files changed, 4 insertions, 0 deletions
diff --git a/vendor/github.com/gorilla/websocket/mask.go b/vendor/github.com/gorilla/websocket/mask.go
index d0742bf..67d0968 100644
--- a/vendor/github.com/gorilla/websocket/mask.go
+++ b/vendor/github.com/gorilla/websocket/mask.go
@@ -9,6 +9,7 @@ package websocket
import "unsafe"
+// #nosec G103 -- (CWE-242) Has been audited
const wordSize = int(unsafe.Sizeof(uintptr(0)))
func maskBytes(key [4]byte, pos int, b []byte) int {
@@ -22,6 +23,7 @@ func maskBytes(key [4]byte, pos int, b []byte) int {
}
// Mask one byte at a time to word boundary.
+ //#nosec G103 -- (CWE-242) Has been audited
if n := int(uintptr(unsafe.Pointer(&b[0]))) % wordSize; n != 0 {
n = wordSize - n
for i := range b[:n] {
@@ -36,11 +38,13 @@ func maskBytes(key [4]byte, pos int, b []byte) int {
for i := range k {
k[i] = key[(pos+i)&3]
}
+ //#nosec G103 -- (CWE-242) Has been audited
kw := *(*uintptr)(unsafe.Pointer(&k))
// Mask one word at a time.
n := (len(b) / wordSize) * wordSize
for i := 0; i < n; i += wordSize {
+ //#nosec G103 -- (CWE-242) Has been audited
*(*uintptr)(unsafe.Pointer(uintptr(unsafe.Pointer(&b[0])) + uintptr(i))) ^= kw
}