about summary refs log tree commit diff
path: root/src/libstd
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2013-09-17 22:20:57 -0700
committerbors <bors@rust-lang.org>2013-09-17 22:20:57 -0700
commitcbd1eefbd350797b783df119fed7956d7e1c74ad (patch)
tree4d8bda542ae0661ee3a254bb906f1797e14d67bf /src/libstd
parent4c6bf4872012c010f84dc7fa2cdfe87522533f89 (diff)
parentfd0fcba9f5b2ec9cb504d6f322c2dd89ab891e08 (diff)
downloadrust-cbd1eefbd350797b783df119fed7956d7e1c74ad.tar.gz
rust-cbd1eefbd350797b783df119fed7956d7e1c74ad.zip
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.
Diffstat (limited to 'src/libstd')
-rw-r--r--src/libstd/str.rs4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/libstd/str.rs b/src/libstd/str.rs
index 93cac8797bb..9707d592a2e 100644
--- a/src/libstd/str.rs
+++ b/src/libstd/str.rs
@@ -1107,8 +1107,8 @@ pub mod raw {
             Some(limit) => (true, limit),
             None => (false, 0)
         };
-        while(*(curr_ptr as *libc::c_char) != 0 as libc::c_char
-             && ((limited_count && ctr < limit) || !limited_count)) {
+        while(((limited_count && ctr < limit) || !limited_count)
+              && *(curr_ptr as *libc::c_char) != 0 as libc::c_char) {
             let env_pair = from_c_str(
                 curr_ptr as *libc::c_char);
             result.push(env_pair);