diff options
author | Mounir IDRASSI <mounir.idrassi@idrix.fr> | 2014-07-14 16:59:14 +0200 |
---|---|---|
committer | Mounir IDRASSI <mounir.idrassi@idrix.fr> | 2014-11-08 23:21:04 +0100 |
commit | 3137d36d9a29ed55be5837abf1be3f959f831abc (patch) | |
tree | 0fead35cac0844fabfdd429ee17bd48ce6520743 /src/Driver/EncryptedIoQueue.c | |
parent | 516fda09a7be48be29a0722aab490b9286e41e73 (diff) | |
download | VeraCrypt-3137d36d9a29ed55be5837abf1be3f959f831abc.tar.gz VeraCrypt-3137d36d9a29ed55be5837abf1be3f959f831abc.zip |
Static Code Analysis : Use Safe string functions inside VeraCrypt Device Driver to avoid potential security issues. Add many checks for NULL pointers to handle low memory use cases.
Diffstat (limited to 'src/Driver/EncryptedIoQueue.c')
-rw-r--r-- | src/Driver/EncryptedIoQueue.c | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/src/Driver/EncryptedIoQueue.c b/src/Driver/EncryptedIoQueue.c index 7cf48cd6..bb76a0f5 100644 --- a/src/Driver/EncryptedIoQueue.c +++ b/src/Driver/EncryptedIoQueue.c @@ -510,6 +510,15 @@ static VOID MainThreadProc (PVOID threadArg) KeWaitForSingleObject (&queue->QueueResumedEvent, Executive, KernelMode, FALSE, NULL);
item = GetPoolBuffer (queue, sizeof (EncryptedIoQueueItem));
+ if (!item)
+ {
+ TCCompleteDiskIrp (irp, STATUS_INSUFFICIENT_RESOURCES, 0);
+ DecrementOutstandingIoCount (queue);
+ IoReleaseRemoveLock (&queue->RemoveLock, irp);
+
+ continue;
+ }
+
item->Queue = queue;
item->OriginalIrp = irp;
item->Status = STATUS_SUCCESS;
@@ -687,6 +696,11 @@ static VOID MainThreadProc (PVOID threadArg) // Create IO request
request = GetPoolBuffer (queue, sizeof (EncryptedIoRequest));
+ if (!request)
+ {
+ CompleteOriginalIrp (item, STATUS_INSUFFICIENT_RESOURCES, 0);
+ break;
+ }
request->Item = item;
request->CompleteOriginalIrp = isLastFragment;
request->Offset = fragmentOffset;
|