@@ -96,7 +96,7 @@ async fn test_hyper_http(case: i64) -> Result<(), Box<dyn std::error::Error>> {
9696
9797 // create the connection
9898 println ! ( "connecting to {}..." , address) ;
99- let stream = tokio:: net:: TcpStream :: connect ( address) . await ?;
99+ let stream = tokio:: net:: TcpStream :: connect ( address) . await ?; // $ Alert[rust/summary/taint-sources]
100100 let io = hyper_util:: rt:: TokioIo :: new ( stream) ;
101101 let ( mut sender, conn) = hyper:: client:: conn:: http1:: handshake ( io) . await ?;
102102
@@ -597,26 +597,26 @@ async fn test_std_tcpstream(case: i64) -> std::io::Result<()> { // Result<(), Bo
597597
598598 if case == 1 {
599599 // create the connection
600- let mut stream = std:: net:: TcpStream :: connect ( address) ?;
600+ let mut stream = std:: net:: TcpStream :: connect ( address) ?; // $ Alert[rust/summary/taint-sources]
601601
602602 // send request
603603 let _ = stream. write_all ( b"GET / HTTP/1.1\n Host:example.com\n \n " ) ;
604604
605605 // read response
606606 let mut buffer = vec ! [ 0 ; 32 * 1024 ] ;
607- let _ = stream. read ( & mut buffer) ; // $ MISSING: Alert[rust/summary/taint-sources]
607+ let _ = stream. read ( & mut buffer) ;
608608
609609 println ! ( "data = {:?}" , buffer) ;
610- sink ( & buffer) ; // $ MISSING: hasTaintFlow
611- sink ( buffer[ 0 ] ) ; // $ MISSING: hasTaintFlow
610+ sink ( & buffer) ; // $ hasTaintFlow=address
611+ sink ( buffer[ 0 ] ) ; // $ hasTaintFlow=address
612612
613613 let buffer_string = String :: from_utf8_lossy ( & buffer) ;
614614 println ! ( "string = {}" , buffer_string) ;
615615 sink ( buffer_string) ; // $ MISSING: hasTaintFlow
616616 } else {
617617 // create the connection
618618 let sock_addr = address. to_socket_addrs ( ) . unwrap ( ) . next ( ) . unwrap ( ) ;
619- let mut stream = std:: net:: TcpStream :: connect_timeout ( & sock_addr, std:: time:: Duration :: new ( 1 , 0 ) ) ?;
619+ let mut stream = std:: net:: TcpStream :: connect_timeout ( & sock_addr, std:: time:: Duration :: new ( 1 , 0 ) ) ?; // $ Alert[rust/summary/taint-sources]
620620
621621 // send request
622622 let _ = stream. write_all ( b"GET / HTTP/1.1\n Host:example.com\n \n " ) ;
@@ -627,14 +627,14 @@ async fn test_std_tcpstream(case: i64) -> std::io::Result<()> { // Result<(), Bo
627627 let mut reader = std:: io:: BufReader :: new ( stream) . take ( 256 ) ;
628628 let mut line = String :: new ( ) ;
629629 loop {
630- match reader. read_line ( & mut line) { // $ MISSING: Alert[rust/summary/taint-sources]
630+ match reader. read_line ( & mut line) {
631631 Ok ( 0 ) => {
632632 println ! ( "end" ) ;
633633 break ;
634634 }
635635 Ok ( _n) => {
636636 println ! ( "line = {}" , line) ;
637- sink ( & line) ; // $ MISSING: hasTaintFlow
637+ sink ( & line) ; // $ hasTaintFlow=&sock_addr
638638 line. clear ( ) ;
639639 }
640640 Err ( e) => {
@@ -668,27 +668,27 @@ async fn test_tokio_tcpstream(case: i64) -> std::io::Result<()> {
668668
669669 // create the connection
670670 println ! ( "connecting to {}..." , address) ;
671- let mut tokio_stream = tokio:: net:: TcpStream :: connect ( address) . await ?;
671+ let mut tokio_stream = tokio:: net:: TcpStream :: connect ( address) . await ?; // $ Alert[rust/summary/taint-sources]
672672
673673 // send request
674674 tokio_stream. write_all ( b"GET / HTTP/1.1\n Host:example.com\n \n " ) . await ?;
675675
676676 if case == 1 {
677677 // peek response
678678 let mut buffer1 = vec ! [ 0 ; 2 * 1024 ] ;
679- let _ = tokio_stream. peek ( & mut buffer1) . await ?; // $ MISSING: Alert[rust/summary/taint-sources]
679+ let _ = tokio_stream. peek ( & mut buffer1) . await ?;
680680
681681 // read response
682682 let mut buffer2 = vec ! [ 0 ; 2 * 1024 ] ;
683- let n2 = tokio_stream. read ( & mut buffer2) . await ?; // $ MISSING: Alert[rust/summary/taint-sources]
683+ let n2 = tokio_stream. read ( & mut buffer2) . await ?;
684684
685685 println ! ( "buffer1 = {:?}" , buffer1) ;
686- sink ( & buffer1) ; // $ MISSING: hasTaintFlow
687- sink ( buffer1[ 0 ] ) ; // $ MISSING: hasTaintFlow
686+ sink ( & buffer1) ; // $ hasTaintFlow=address
687+ sink ( buffer1[ 0 ] ) ; // $ hasTaintFlow=address
688688
689689 println ! ( "buffer2 = {:?}" , buffer2) ;
690- sink ( & buffer2) ; // $ MISSING: hasTaintFlow
691- sink ( buffer2[ 0 ] ) ; // $ MISSING: hasTaintFlow
690+ sink ( & buffer2) ; // $ hasTaintFlow=address
691+ sink ( buffer2[ 0 ] ) ; // $ hasTaintFlow=address
692692
693693 let buffer_string = String :: from_utf8_lossy ( & buffer2[ ..n2] ) ;
694694 println ! ( "string = {}" , buffer_string) ;
@@ -703,7 +703,7 @@ async fn test_tokio_tcpstream(case: i64) -> std::io::Result<()> {
703703 }
704704 Ok ( _n) => {
705705 println ! ( "buffer = {:?}" , buffer) ;
706- sink ( & buffer) ; // $ MISSING: hasTaintFlow
706+ sink ( & buffer) ; // $ hasTaintFlow=address
707707 break ; // (or we could wait for more data)
708708 }
709709 Err ( ref e) if e. kind ( ) == std:: io:: ErrorKind :: WouldBlock => {
@@ -726,7 +726,7 @@ async fn test_tokio_tcpstream(case: i64) -> std::io::Result<()> {
726726 }
727727 Ok ( _n) => {
728728 println ! ( "buffer = {:?}" , buffer) ;
729- sink ( & buffer) ; // $ MISSING: hasTaintFlow
729+ sink ( & buffer) ; // $ hasTaintFlow=address
730730 break ; // (or we could wait for more data)
731731 }
732732 Err ( ref e) if e. kind ( ) == std:: io:: ErrorKind :: WouldBlock => {
@@ -750,7 +750,7 @@ async fn test_std_to_tokio_tcpstream() -> std::io::Result<()> {
750750
751751 // create the connection
752752 println ! ( "connecting to {}..." , address) ;
753- let std_stream = std:: net:: TcpStream :: connect ( address) ?;
753+ let std_stream = std:: net:: TcpStream :: connect ( address) ?; // $ Alert[rust/summary/taint-sources]
754754
755755 // convert to tokio stream
756756 std_stream. set_nonblocking ( true ) ?;
0 commit comments