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

Simplified _libssh2_check_length #350

Merged
merged 2 commits into from Apr 5, 2019
Merged
Changes from 1 commit
Commits
File filter...
Filter file types
Jump to…
Jump to file or symbol
Failed to load files and symbols.

Always

Just for now

Prev

Updated _libssh2_check_length()

Updated suggested patch to protect against incorrect usage which could cause a wrap-around value to return success.
  • Loading branch information...
willco007 committed Apr 4, 2019
commit b4289eeb84057d3d5e041af72af000a80b4f40d6
@@ -811,7 +811,9 @@ int _libssh2_get_bignum_bytes(struct string_buf *buf, unsigned char **outbuf)

int _libssh2_check_length(struct string_buf *buf, size_t len)
{
return (len <= (size_t)((buf->data + buf->len) - buf->dataptr));
unsigned char *endp = &buf->data[buf->len];
size_t left = endp - buf->dataptr;
return ((len <= left) && (left <= buf->len));
}

/* Wrappers */
ProTip! Use n and p to navigate between commits in a pull request.
You can’t perform that action at this time.