File tree Expand file tree Collapse file tree 2 files changed +11
-1
lines changed
csharp/ql/lib/semmle/code/csharp Expand file tree Collapse file tree 2 files changed +11
-1
lines changed Original file line number Diff line number Diff line change @@ -354,6 +354,14 @@ class SystemStringClass extends StringType {
354
354
result .getReturnType ( ) instanceof StringType
355
355
}
356
356
357
+ /** Gets the `ReplaceLineEndings(string) method. */
358
+ Method getReplaceLineEndingsMethod ( ) {
359
+ result .getDeclaringType ( ) = this and
360
+ result .hasName ( "ReplaceLineEndings" ) and
361
+ result .getNumberOfParameters ( ) = 1 and
362
+ result .getReturnType ( ) instanceof StringType
363
+ }
364
+
357
365
/** Gets a `Format(...)` method. */
358
366
Method getFormatMethod ( ) {
359
367
result .getDeclaringType ( ) = this and
Original file line number Diff line number Diff line change @@ -70,7 +70,9 @@ private class ExternalLoggingExprSink extends Sink {
70
70
private class StringReplaceSanitizer extends Sanitizer {
71
71
StringReplaceSanitizer ( ) {
72
72
exists ( Method m |
73
- exists ( SystemStringClass s | m = s .getReplaceMethod ( ) or m = s .getRemoveMethod ( ) )
73
+ exists ( SystemStringClass s |
74
+ m = s .getReplaceMethod ( ) or m = s .getRemoveMethod ( ) or m = s .getReplaceLineEndingsMethod ( )
75
+ )
74
76
or
75
77
m = any ( SystemTextRegularExpressionsRegexClass r ) .getAReplaceMethod ( )
76
78
|
You can’t perform that action at this time.
0 commit comments