diff options
author | bors[bot] <26634292+bors[bot]@users.noreply.github.com> | 2020-04-06 16:28:20 +0000 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-04-06 16:28:20 +0000 |
commit | 5c8cdd005270557ceb91cdafc1eca7c971ee9219 (patch) | |
tree | dfc5ca5786438e85ca36d654fe2fc3b37cfd07db /src/sys/socket/addr.rs | |
parent | 627dff904688ad223558a50bd499207e940e47cd (diff) | |
parent | 3c2107bdc221a90b02d3f7118dd96f3496762cd0 (diff) | |
download | nix-5c8cdd005270557ceb91cdafc1eca7c971ee9219.zip |
Merge #1205
1205: unistd: avoid infinite loop caused by reserve_double_buffer_size r=asomers a=stevendanna
Functions such as Group::from_anything use reserve_double_buffer_size
in a loop, expecting it to return ERANGE if the passed limit is
reached.
However, the returned vector is passed as pointer to a libc function
that writes data into memory and doesn't update the length of the
Vec. Because of this, the previous code would never return ERANGE and
the calling loops would never exit if they hit a case where the
required buffer was larger than the maximum buffer.
This fixes the problem by checking the capacity rather than the
length.
Signed-off-by: Steven Danna <steve@chef.io>
Co-authored-by: Steven Danna <steve@chef.io>
Diffstat (limited to 'src/sys/socket/addr.rs')
0 files changed, 0 insertions, 0 deletions