mirror of
https://github.com/ShareX/ShareX.git
synced 2024-06-23 08:40:39 +12:00
Check length
This commit is contained in:
parent
856a1a057c
commit
280f3c5f8f
|
@ -42,6 +42,7 @@ public class SingleInstanceManager : IDisposable
|
|||
private const string MutexName = "82E6AC09-0FEF-4390-AD9F-0DD3F5561EFC";
|
||||
private const string AppName = "ShareX";
|
||||
private static readonly string PipeName = $"{Environment.MachineName}-{Environment.UserName}-{AppName}";
|
||||
private const int MaxArgumentsLength = 100;
|
||||
|
||||
private readonly Mutex mutex;
|
||||
private CancellationTokenSource cts;
|
||||
|
@ -103,6 +104,11 @@ private async Task ListenForConnectionsAsync()
|
|||
{
|
||||
int length = reader.ReadInt32();
|
||||
|
||||
if (length < 0 || length > MaxArgumentsLength)
|
||||
{
|
||||
throw new Exception("Invalid length: " + length);
|
||||
}
|
||||
|
||||
string[] args = new string[length];
|
||||
|
||||
for (int i = 0; i < length; i++)
|
||||
|
|
Loading…
Reference in a new issue