mirror of
https://github.com/github/codeql.git
synced 2025-12-17 01:03:14 +01:00
20 lines
583 B
C#
20 lines
583 B
C#
using System.Web.UI.WebControls;
|
|
using System.Resources;
|
|
using System.IO;
|
|
using System.Text;
|
|
using System;
|
|
|
|
class BadResourceReader
|
|
{
|
|
public static void Deserialize(TextBox data)
|
|
{
|
|
var ds = new ResourceReader(new MemoryStream(Encoding.UTF8.GetBytes(data.Text))); // $ Alert[cs/unsafe-deserialization-untrusted-input]
|
|
// BAD
|
|
var dict = ds.GetEnumerator();
|
|
while (dict.MoveNext())
|
|
Console.WriteLine(" {0}: '{1}' (Type {2})",
|
|
dict.Key, dict.Value, dict.Value.GetType().Name);
|
|
ds.Close();
|
|
}
|
|
}
|