Address review findings on the VNC server, session auth and capture decoder

This commit is contained in:
Viktor Liu
2026-08-27 18:33:52 +02:00
parent 09e069a175
commit 47d8f912e5
18 changed files with 179 additions and 72 deletions
+5 -3
View File
@@ -538,11 +538,13 @@ func matchRFBSecurityFailure(p []byte) (string, bool) {
if len(p) < 5 || p[0] != 0 {
return "", false
}
reasonLen := int(p[1])<<24 | int(p[2])<<16 | int(p[3])<<8 | int(p[4])
if reasonLen <= 0 || reasonLen > 4096 || 5+reasonLen != len(p) {
// Kept as uint32: converting to int first would wrap to a negative value
// on a 32-bit build and lose the annotation to the length check below.
reasonLen := binary.BigEndian.Uint32(p[1:5])
if reasonLen == 0 || reasonLen > 4096 || 5+int(reasonLen) != len(p) {
return "", false
}
return string(p[5 : 5+reasonLen]), true
return string(p[5 : 5+int(reasonLen)]), true
}
// vncRejectCodes mirrors the RejectCode* constants in