Skip to content

Commit d8cc2c1

Browse files
committed
Add a warning about infinite reading in read_(until|line)
1 parent b85e3fe commit d8cc2c1

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

src/libstd/io/mod.rs

+8
Original file line numberDiff line numberDiff line change
@@ -1883,6 +1883,10 @@ pub trait BufRead: Read {
18831883
///
18841884
/// If successful, this function will return the total number of bytes read.
18851885
///
1886+
/// This function is blocking and should be used carefully: it is possible for
1887+
/// an attacker to continuously send bytes without ever sending the delimiter
1888+
/// or EOF.
1889+
///
18861890
/// # Errors
18871891
///
18881892
/// This function will ignore all instances of [`ErrorKind::Interrupted`] and
@@ -1945,6 +1949,10 @@ pub trait BufRead: Read {
19451949
///
19461950
/// If this function returns `Ok(0)`, the stream has reached EOF.
19471951
///
1952+
/// This function is blocking and should be used carefully: it is possible for
1953+
/// an attacker to continuously send bytes without ever sending a newline
1954+
/// or EOF.
1955+
///
19481956
/// # Errors
19491957
///
19501958
/// This function has the same error semantics as [`read_until`] and will

0 commit comments

Comments
 (0)