Skip to content
Snippets Groups Projects
  • Carl Lerche's avatar
    ebe52273
    Fix `copy_to_slice` to use correct increment var · ebe52273
    Carl Lerche authored
    This patch fixes the `copy_to_slice` function, rectifying the logic.
    However, the incorrect code does not result in incorrect behavior as the
    only case `cnt != src.len()` is during the final iteration, and since
    `src.len()` is greater than `cnt` in that case, `off` will be
    incremented by too much, but this will still trigger the `off <
    dst.len()` condition.
    
    The only danger is `src.len()` could cause an overflow.
    ebe52273
    History
    Fix `copy_to_slice` to use correct increment var
    Carl Lerche authored
    This patch fixes the `copy_to_slice` function, rectifying the logic.
    However, the incorrect code does not result in incorrect behavior as the
    only case `cnt != src.len()` is during the final iteration, and since
    `src.len()` is greater than `cnt` in that case, `off` will be
    incremented by too much, but this will still trigger the `off <
    dst.len()` condition.
    
    The only danger is `src.len()` could cause an overflow.