Use the package properties to know how big to make the token buffers.

This commit is contained in:
antiduh
2014-07-03 20:16:22 +00:00
parent 9636bb44b5
commit cabf7e5249
2 changed files with 11 additions and 3 deletions

View File

@@ -87,8 +87,12 @@ namespace NSspi.Contexts
throw new InvalidOperationException( "Must provide the server's response when continuing the init process." );
}
outTokenBuffer = new SecureBuffer( new byte[12288], BufferType.Token );
// The security package tells us how big its biggest token will be. We'll allocate a buffer
// that size, and it'll tell us how much it used.
outTokenBuffer = new SecureBuffer(
new byte[ this.Credential.PackageInfo.MaxTokenLength ],
BufferType.Token
);
serverBuffer = null;
if ( serverToken != null )

View File

@@ -79,7 +79,11 @@ namespace NSspi.Contexts
}
clientBuffer = new SecureBuffer( clientToken, BufferType.Token );
outBuffer = new SecureBuffer( new byte[12288], BufferType.Token );
outBuffer = new SecureBuffer(
new byte[ this.Credential.PackageInfo.MaxTokenLength ],
BufferType.Token
);
using ( clientAdapter = new SecureBufferAdapter( clientBuffer ) )
{