Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Pass comment as CString #329

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Commits on Sep 16, 2024

  1. Pass comment as CString

    The `libssh2_knownhost_addc()` expects `comment` to be a C string: it
    copies `commentlen + 1` bytes internally from the buffer pointed by
    `comment` pointer. Granted, this is misleading: one would expect that
    if a function takes a pointer and length of data, it wouldn't access
    memory past this limit.
    
    Passing a `&str` as a pointer and its length is incorrect and results
    in segmentation fault with `rustc` > 1.78.0 on macOS 14.6.1 (23G93)
    and FreeBSD 14 - we pass empty &str literal to the function.
    tduda-fudosecurity committed Sep 16, 2024
    Configuration menu
    Copy the full SHA
    549a7f5 View commit details
    Browse the repository at this point in the history

Commits on Sep 17, 2024

  1. Use as_bytes().len() to get comment length

    Method `count_bytes()` has been added fairly recently, in 1.79.0.
    This change is to support older compilers.
    tduda-fudosecurity committed Sep 17, 2024
    Configuration menu
    Copy the full SHA
    e376dd3 View commit details
    Browse the repository at this point in the history