Skip to content

Commit cbd1eef

Browse files
committed
auto merge of #9281 : brson/rust/multistring, r=alexcrichton
When `count` is `Some` this function was reading a byte past the end of the buffer.
2 parents 4c6bf48 + fd0fcba commit cbd1eef

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/libstd/str.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1107,8 +1107,8 @@ pub mod raw {
11071107
Some(limit) => (true, limit),
11081108
None => (false, 0)
11091109
};
1110-
while(*(curr_ptr as *libc::c_char) != 0 as libc::c_char
1111-
&& ((limited_count && ctr < limit) || !limited_count)) {
1110+
while(((limited_count && ctr < limit) || !limited_count)
1111+
&& *(curr_ptr as *libc::c_char) != 0 as libc::c_char) {
11121112
let env_pair = from_c_str(
11131113
curr_ptr as *libc::c_char);
11141114
result.push(env_pair);

0 commit comments

Comments
 (0)