mirror of
https://github.com/TalAloni/SMBLibrary.git
synced 2025-04-30 02:37:49 +02:00
Client: Fix possible NullReferenceException when disconnection occur during directory enumeration
This commit is contained in:
parent
a2b96f638c
commit
aeb8849683
2 changed files with 11 additions and 3 deletions
|
@ -1,4 +1,4 @@
|
|||
/* Copyright (C) 2014-2023 Tal Aloni <tal.aloni.il@gmail.com>. All rights reserved.
|
||||
/* Copyright (C) 2014-2024 Tal Aloni <tal.aloni.il@gmail.com>. All rights reserved.
|
||||
*
|
||||
* You can redistribute this program and/or modify it under the terms of
|
||||
* the GNU Lesser Public License as published by the Free Software Foundation,
|
||||
|
@ -181,7 +181,11 @@ namespace SMBLibrary.Client
|
|||
|
||||
TrySendMessage(request);
|
||||
reply = m_client.WaitForMessage(CommandName.SMB_COM_TRANSACTION2);
|
||||
if (reply.Header.Status == NTStatus.STATUS_SUCCESS && reply.Commands[0] is Transaction2Response)
|
||||
if (reply == null)
|
||||
{
|
||||
return NTStatus.STATUS_INVALID_SMB;
|
||||
}
|
||||
else if (reply.Header.Status == NTStatus.STATUS_SUCCESS && reply.Commands[0] is Transaction2Response)
|
||||
{
|
||||
response = (Transaction2Response)reply.Commands[0];
|
||||
Transaction2FindNext2Response nextSubcommandResponse = new Transaction2FindNext2Response(response.TransParameters, response.TransData, reply.Header.UnicodeFlag);
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* Copyright (C) 2017-2023 Tal Aloni <tal.aloni.il@gmail.com>. All rights reserved.
|
||||
/* Copyright (C) 2017-2024 Tal Aloni <tal.aloni.il@gmail.com>. All rights reserved.
|
||||
*
|
||||
* You can redistribute this program and/or modify it under the terms of
|
||||
* the GNU Lesser Public License as published by the Free Software Foundation,
|
||||
|
@ -165,6 +165,10 @@ namespace SMBLibrary.Client
|
|||
request.Reopen = false;
|
||||
TrySendCommand(request);
|
||||
response = m_client.WaitForCommand(request.MessageID);
|
||||
if (response == null)
|
||||
{
|
||||
return NTStatus.STATUS_INVALID_SMB;
|
||||
}
|
||||
}
|
||||
return response.Header.Status;
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue