@@ -238,21 +238,12 @@ predicate insideFunctionValueMoveTo(Element src, Element dest)
238238 returnArgument ( c .getTarget ( ) , sourceArg )
239239 and src = c .getArgument ( sourceArg )
240240 and dest = c )
241- or exists ( MessageExpr send |
242- methodReturningAnyArgument ( send .getStaticTarget ( ) )
243- and not send instanceof FormattingFunctionCall
244- and src = send .getAnArgument ( )
245- and dest = send )
246241 or exists ( FormattingFunctionCall formattingSend , int arg , FormatLiteral format , string argFormat |
247242 dest = formattingSend
248243 and formattingSend .getArgument ( arg ) = src
249244 and format = formattingSend .getFormat ( )
250245 and format .getConversionChar ( arg - formattingSend .getTarget ( ) .getNumberOfParameters ( ) ) = argFormat
251246 and ( argFormat = "s" or argFormat = "S" or argFormat = "@" ) )
252- or exists ( ExprMessageExpr send |
253- methodReturningReceiver ( send .getStaticTarget ( ) )
254- and src = send .getReceiver ( )
255- and dest = send )
256247 // Expressions computed from tainted data are also tainted
257248 or ( exists ( FunctionCall call | dest = call and isPureFunction ( call .getTarget ( ) .getName ( ) ) |
258249 call .getAnArgument ( ) = src
@@ -457,60 +448,6 @@ private predicate returnArgument(Function f, int sourceArg)
457448 or ( f .hasGlobalName ( "gethostbyaddr" ) and sourceArg = 0 )
458449}
459450
460- /** A method where if any argument is tainted, the return value should be, too */
461- private predicate methodReturningAnyArgument ( MemberFunction method ) {
462- method .getQualifiedName ( ) .matches ( "NS%Array%::+array%" ) or
463- method .getQualifiedName ( ) .matches ( "NS%Array%::-arrayBy%" ) or
464- method .getQualifiedName ( ) .matches ( "NS%Array%::-componentsJoinedByString:" ) or
465- method .getQualifiedName ( ) .matches ( "NS%Array%::-init%" ) or
466- method .getQualifiedName ( ) .matches ( "NS%Data%::+dataWith%" ) or
467- method .getQualifiedName ( ) .matches ( "NS%Data%::-initWith%" ) or
468- method .getQualifiedName ( ) .matches ( "NS%String%::+pathWithComponents:" ) or
469- method .getQualifiedName ( ) .matches ( "NS%String%::+stringWith%" ) or
470- method .getQualifiedName ( ) .matches ( "NS%String%::-initWithCString:" ) or
471- method .getQualifiedName ( ) .matches ( "NS%String%::-initWithCString:length:" ) or
472- method .getQualifiedName ( ) .matches ( "NS%String%::-initWithCStringNoCopy:length:" ) or
473- method .getQualifiedName ( ) .matches ( "NS%String%::-initWithCharacters:length:" ) or
474- method .getQualifiedName ( ) .matches ( "NS%String%::-initWithCharactersNoCopy:length:freeWhenDone:" ) or
475- method .getQualifiedName ( ) .matches ( "NS%String%::-initWithFormat:" ) or
476- method .getQualifiedName ( ) .matches ( "NS%String%::-initWithFormat:arguments:" ) or
477- method .getQualifiedName ( ) .matches ( "NS%String%::-initWithString:" ) or
478- method .getQualifiedName ( ) .matches ( "NS%String%::-initWithUTF8String:" ) or
479- method .getQualifiedName ( ) .matches ( "NS%String%::-stringByAppendingFormat:" ) or
480- method .getQualifiedName ( ) .matches ( "NS%String%::-stringByAppendingString:" ) or
481- method .getQualifiedName ( ) .matches ( "NS%String%::-stringByPaddingToLength:withString:startingAtIndex:" ) or
482- method .getQualifiedName ( ) .matches ( "NS%String%::-stringByReplacing%" ) or
483- method .getQualifiedName ( ) .matches ( "NS%String%::-stringsByAppendingPaths:" )
484- }
485-
486- /** A method where if the receiver is tainted, the return value should be, too */
487- private predicate methodReturningReceiver ( MemberFunction method ) {
488- method .getQualifiedName ( ) .matches ( "NS%Array%::-arrayBy%" ) or
489- method .getQualifiedName ( ) .matches ( "NS%Array%::-componentsJoinedByString:" ) or
490- method .getQualifiedName ( ) .matches ( "NS%Array%::-firstObject" ) or
491- method .getQualifiedName ( ) .matches ( "NS%Array%::-lastObject" ) or
492- method .getQualifiedName ( ) .matches ( "NS%Array%::-objectAt%" ) or
493- method .getQualifiedName ( ) .matches ( "NS%Array%::-pathsMatchingExtensions:" ) or
494- method .getQualifiedName ( ) .matches ( "NS%Array%::-sortedArray%" ) or
495- method .getQualifiedName ( ) .matches ( "NS%Array%::-subarrayWithRange:" ) or
496- method .getQualifiedName ( ) .matches ( "NS%Data%::-bytes" ) or
497- method .getQualifiedName ( ) .matches ( "NS%Data%::-subdataWithRange:" ) or
498- method .getQualifiedName ( ) .matches ( "NS%String%::-capitalizedString%" ) or
499- method .getQualifiedName ( ) .matches ( "NS%String%::-componentsSeparatedByCharactersInSet:" ) or
500- method .getQualifiedName ( ) .matches ( "NS%String%::-componentsSeparatedByString:" ) or
501- method .getQualifiedName ( ) .matches ( "NS%String%::-cStringUsingEncoding:" ) or
502- method .getQualifiedName ( ) .matches ( "NS%String%::-dataUsingEncoding:%" ) or
503- method .getQualifiedName ( ) .matches ( "NS%String%::-lowercaseString%" ) or
504- method .getQualifiedName ( ) .matches ( "NS%String%::-pathComponents" ) or
505- method .getQualifiedName ( ) .matches ( "NS%String%::-stringBy%" ) or
506- method .getQualifiedName ( ) .matches ( "NS%String%::-stringsByAppendingPaths:" ) or
507- method .getQualifiedName ( ) .matches ( "NS%String%::-substringFromIndex:" ) or
508- method .getQualifiedName ( ) .matches ( "NS%String%::-substringToIndex:" ) or
509- method .getQualifiedName ( ) .matches ( "NS%String%::-substringWithRange:" ) or
510- method .getQualifiedName ( ) .matches ( "NS%String%::-uppercaseString%" ) or
511- method .getQualifiedName ( ) .matches ( "NS%String%::-UTF8String" )
512- }
513-
514451/**
515452 * Resolve potential target function(s) for `call`.
516453 *
0 commit comments