mirror of
https://github.com/github/codeql.git
synced 2025-12-16 16:53:25 +01:00
14 lines
311 B
C#
14 lines
311 B
C#
using System.Runtime.Serialization;
|
|
using System.IO;
|
|
using System;
|
|
|
|
class BadDataContractSerializer
|
|
{
|
|
public static object Deserialize(Type type, Stream s)
|
|
{
|
|
var ds = new DataContractSerializer(type);
|
|
// BAD
|
|
return ds.ReadObject(s); // $ Alert[cs/unsafe-deserialization]
|
|
}
|
|
}
|