summaryrefslogtreecommitdiff
path: root/src/sys/socket/addr.rs
diff options
context:
space:
mode:
authorSteven Danna <steve@chef.io>2020-04-06 12:54:59 +0000
committerSteven Danna <steve@chef.io>2020-04-06 14:27:18 +0000
commit3c2107bdc221a90b02d3f7118dd96f3496762cd0 (patch)
treedfc5ca5786438e85ca36d654fe2fc3b37cfd07db /src/sys/socket/addr.rs
parent627dff904688ad223558a50bd499207e940e47cd (diff)
downloadnix-3c2107bdc221a90b02d3f7118dd96f3496762cd0.zip
unistd: avoid infinite loop caused by reserve_double_buffer_size
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>
Diffstat (limited to 'src/sys/socket/addr.rs')
0 files changed, 0 insertions, 0 deletions