Jump to content
alex1234

error in OverbyteIcsSspi.pas

Recommended Posts

There is bug in OverbyteIcsSspi.pas
Incorrect definition of
DECRYPT_MESSAGE_FN = function(phContext: PCtxtHandle; pMessage: PSecBufferDesc; MessageSeqNo: Cardinal; fQOP: DWORD): SECURITY_STATUS;

fQOP is not a DWORD, its PULONG - pointer to DWORD.
https://learn.microsoft.com/en-us/windows/win32/secauthn/decryptmessage--negotiate

Such incorrect call may lead to access violation errors or data corruption.
I think it should be defined like
DECRYPT_MESSAGE_FN = function(phContext: PCtxtHandle; pMessage: PSecBufferDesc; MessageSeqNo: Cardinal; var fQOP: DWORD): SECURITY_STATUS;
or
DECRYPT_MESSAGE_FN = function(phContext: PCtxtHandle; pMessage: PSecBufferDesc; MessageSeqNo: Cardinal; fQOP: PULONG): SECURITY_STATUS;

Share this post


Link to post

Thanks, this was fixed last week when you reported it by email, it will be in SVN in a day or two.  However, ICS does not use DECRYPT_MESSAGE_FN .

 

Angus

Share this post


Link to post

Thank you.
François said its better to post bug reports here so I posted a copy here.

 

>However, ICS does not use DECRYPT_MESSAGE_FN


Yes, but someone can use this module for its own code (like me :). And sometimes this code may work, sometimes throw errors.


Alex

Share this post


Link to post

I think I found another bug in this module.

type
ULONG_PTR = Longword;
type
_SecHandle = packed record
dwLower : ULONG_PTR;
dwUpper : ULONG_PTR;
end;

This will lead to problems in x64 mode.
Should be

type
ULONG_PTR = NativeUInt;

OR something like

type
{$IF (defined(CPUX64) or defined(CPU64BITS) or defined(CPUARM64))}
ULONG_PTR = UInt64;
{$else}
ULONG_PTR = Longword;
{$endif}

Alex

Share this post


Link to post
On 7/15/2023 at 2:37 PM, alex1234 said:

type
{$IF (defined(CPUX64) or defined(CPU64BITS) or defined(CPUARM64))}
ULONG_PTR = UInt64;
{$else}
ULONG_PTR = Longword;
{$endif}

Better to check if NativeUInt is declared

Share this post


Link to post

ULONG_PTR should not have been declared in the SSPI unit, we have a Types unit that collects together backward compatible types and already had ULONG_PTR.

 

Angus

 

 

Share this post


Link to post

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×