Skip to content

Commit 4b52f2a

Browse files
authored
Merge pull request #179 from reki9185/fix/getSecurityHeaderType
fix: getSecurityHeaderType
2 parents fb44028 + c0ee396 commit 4b52f2a

1 file changed

Lines changed: 6 additions & 0 deletions

File tree

internal/nas/nas_security/security.go

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -362,6 +362,12 @@ func DecodePlainNasNoIntegrityCheck(payload []byte) (*nas.Message, error) {
362362
}
363363

364364
msg := new(nas.Message)
365+
366+
// A plain NAS message must have a minimum length of 2 bytes.
367+
if len(payload) < 2 {
368+
return nil, fmt.Errorf("NAS payload is too short")
369+
}
370+
365371
msg.SecurityHeaderType = nas.GetSecurityHeaderType(payload) & SecurityHeaderTypeMask
366372
if msg.SecurityHeaderType == nas.SecurityHeaderTypeIntegrityProtectedAndCiphered ||
367373
msg.SecurityHeaderType == nas.SecurityHeaderTypeIntegrityProtectedAndCipheredWithNew5gNasSecurityContext {

0 commit comments

Comments
 (0)