Skip to content

Commit 44fe34a

Browse files
committed
use the correct string type in the tainted-path examples
1 parent a6b094c commit 44fe34a

File tree

3 files changed

+3
-3
lines changed

3 files changed

+3
-3
lines changed

csharp/ql/src/Security Features/CWE-022/examples/TaintedPath.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ public class TaintedPathHandler : IHttpHandler
66
{
77
public void ProcessRequest(HttpContext ctx)
88
{
9-
String filename = ctx.Request.QueryString["path"];
9+
string filename = ctx.Request.QueryString["path"];
1010
// BAD: This could read any file on the filesystem.
1111
ctx.Response.Write(File.ReadAllText(filename));
1212
}

csharp/ql/src/Security Features/CWE-022/examples/TaintedPathGoodFolder.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ public class TaintedPathHandler : IHttpHandler
66
{
77
public void ProcessRequest(HttpContext ctx)
88
{
9-
String filename = ctx.Request.QueryString["path"];
9+
string filename = ctx.Request.QueryString["path"];
1010

1111
string publicFolder = Path.GetFullPath("/home/" + user + "/public");
1212
string filePath = Path.GetFullPath(Path.Combine(publicFolder, filename));

csharp/ql/src/Security Features/CWE-022/examples/TaintedPathGoodNormalize.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ public class TaintedPathHandler : IHttpHandler
66
{
77
public void ProcessRequest(HttpContext ctx)
88
{
9-
String filename = ctx.Request.QueryString["path"];
9+
string filename = ctx.Request.QueryString["path"];
1010
// GOOD: ensure that the filename has no path separators or parent directory references
1111
if (filename.Contains("..") || filename.Contains("/") || filename.Contains("\\"))
1212
{

0 commit comments

Comments
 (0)