summaryrefslogtreecommitdiff
path: root/vendor/github.com/gorilla/websocket/mask.go
diff options
context:
space:
mode:
authorLibravatar dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>2023-11-28 11:05:07 +0000
committerLibravatar GitHub <noreply@github.com>2023-11-28 11:05:07 +0000
commit2eb8b8eeb41384dbf34989d7a850b4d498d90064 (patch)
tree132bd8b2504744945a5af0808782b43163044f69 /vendor/github.com/gorilla/websocket/mask.go
parent[bugfix] Don't copy ptr fields in caches (#2386) (diff)
downloadgotosocial-2eb8b8eeb41384dbf34989d7a850b4d498d90064.tar.xz
[chore]: Bump github.com/gorilla/websocket from 1.5.0 to 1.5.1 (#2335)
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: kim <grufwub@gmail.com>
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 d0742bf2a..67d0968be 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
}