Exploit databaseDownload repository ZIP
GH-88d8bc551618926a04536090300b4292
dungnm24/cve-2020-0796
Sources for CVE-2020-0796
81 sourcesPreferred order: Exploit-DB, Metasploit, then GitHub repositories by stars. Open preferred source
Repository files22
dungnm24/cve-2020-0796Revision fe7aebbe1789
- ↑..Parent directory
- Enums.cs
- TS_RFX_BLOCKT.cs
- TS_RFX_CAPS.cs
- TS_RFX_CAPSET.cs
- TS_RFX_CHANNELS.cs
- TS_RFX_CHANNELT.cs
- TS_RFX_CLNT_CAPS_CONTAINER.cs
- TS_RFX_CODEC_CHANNELT.cs
- TS_RFX_CODEC_QUANT.cs
- TS_RFX_CODEC_VERSIONS.cs
- TS_RFX_CODEC_VERSIONT.cs
- TS_RFX_CONTEXT.cs
- TS_RFX_FRAME_BEGIN.cs
- TS_RFX_FRAME_END.cs
- TS_RFX_ICAP.cs
- TS_RFX_RECT.cs
- TS_RFX_REGION.cs
- TS_RFX_SRVR_CAPS_CONTAINER.cs
- TS_RFX_SYNC.cs
- TS_RFX_TILE.cs
- TS_RFX_TILESET.cs
- TypeMarshal.cs
Files from this repository share one source choice. Supporting files may cover other vulnerabilities.
WindowsProtocolTestSuites/ProtoSDK/MS-RDPRFX/Types/TypeMarshal.cs
C# · 2,025 bytes// Copyright (c) Microsoft. All rights reserved.
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
using System;
using Microsoft.Protocols.TestTools.StackSdk.Messages;
using Microsoft.Protocols.TestTools.StackSdk.Messages.Marshaling;
using System.IO;
namespace Microsoft.Protocols.TestTools.StackSdk.RemoteDesktop.Rdprfx
{
/// <summary>
/// TypeMarshal is a type marshal class.
/// It can marshal a struct to block memory.
/// </summary>
internal static class TypeMarshal
{
/// <summary>
/// Marshal a struct to managed byte array.
/// </summary>
/// <typeparam name="T">Type of struct.</typeparam>
/// <param name="t">A struct to marshal.</param>
/// <returns>Marshalled managed byte array.</returns>
public static byte[] ToBytes<T>(T t) where T : struct
{
int size;
using (MessageUtils utils = new MessageUtils(null))
{
size = utils.GetSize(t);
}
// The size returned by MessageUtils.GetSize is not always
// the actual block size of the given structure,
// so allocate a buffer whose size is twice as large as it.
// The actual size will be calculated later.
byte[] buf = new byte[size * 2];
using (MemoryStream memoryStream = new MemoryStream(buf))
{
using (Channel channel = new Channel(null, memoryStream))
{
channel.BeginWriteGroup();
channel.Write<T>(t);
channel.EndWriteGroup();
int actualSize = (int)channel.Stream.Position;
byte[] actualBuf = new byte[actualSize];
Array.Copy(buf, 0, actualBuf, 0, actualSize);
return actualBuf;
}
}
}
}
public interface IMarshalable
{
byte[] ToBytes();
}
}