From 810046a3df92b2139ea4def0f9126c323867ebc5 Mon Sep 17 00:00:00 2001 From: Vadim Date: Tue, 9 Feb 2021 09:15:02 -0500 Subject: [PATCH] fix int overflow bug for 32-bit builds (#17) fixes #16 --- negotiator.go | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/negotiator.go b/negotiator.go index a9f71d8..9ad4bf0 100644 --- a/negotiator.go +++ b/negotiator.go @@ -20,6 +20,10 @@ const ( negotiate128 = 0x20000000 // 128-bit session key negotiation negotiateKeyExch = 0x40000000 // Key exchange negotiate56 = 0x80000000 // 56-bit encryption + + negotiateFlags uint32 = negotiateAlwaysSign | negotiateExtendedSessionSecurity | negotiateKeyExch | + negotiate128 | negotiate56 | negotiateNTLM | requestTarget | negotiateOEM | + negotiateUnicode | negotiateVersion ) var ( @@ -33,11 +37,10 @@ var ( // for details see https://docs.microsoft.com/en-us/openspecs/windows_protocols/ms-nlmp/b34032e5-3aae-4bc6-84c3-c6d80eadf7f2 func negotiate() []byte { ret := make([]byte, 40) - flags := negotiateAlwaysSign | negotiateExtendedSessionSecurity | negotiateKeyExch | negotiate128 | negotiate56 | negotiateNTLM | requestTarget | negotiateOEM | negotiateUnicode | negotiateVersion copy(ret, []byte("NTLMSSP\x00")) // protocol put32(ret[8:], 1) // type - put32(ret[12:], uint32(flags)) // flags + put32(ret[12:], negotiateFlags) // flags put16(ret[16:], 0) // NT domain name length put16(ret[18:], 0) // NT domain name max length put32(ret[20:], 0) // NT domain name offset