mirror of
https://github.com/PowerShell/openssh-portable.git
synced 2025-07-31 01:35:11 +02:00
upstream: let sshbuf_find/cmp take a void* for the
search/comparison argument, instead of a u_char*. Saves callers needing to cast. OpenBSD-Commit-ID: d63b69b7c5dd570963e682f758f5a47b825605ed
This commit is contained in:
parent
7adf6c430d
commit
49fa065a1b
@ -1,4 +1,4 @@
|
|||||||
/* $OpenBSD: sshbuf-misc.c,v 1.10 2019/07/18 13:26:00 djm Exp $ */
|
/* $OpenBSD: sshbuf-misc.c,v 1.11 2019/07/30 05:04:49 djm Exp $ */
|
||||||
/*
|
/*
|
||||||
* Copyright (c) 2011 Damien Miller
|
* Copyright (c) 2011 Damien Miller
|
||||||
*
|
*
|
||||||
@ -195,7 +195,7 @@ sshbuf_dup_string(struct sshbuf *buf)
|
|||||||
|
|
||||||
int
|
int
|
||||||
sshbuf_cmp(const struct sshbuf *b, size_t offset,
|
sshbuf_cmp(const struct sshbuf *b, size_t offset,
|
||||||
const u_char *s, size_t len)
|
const void *s, size_t len)
|
||||||
{
|
{
|
||||||
if (sshbuf_ptr(b) == NULL)
|
if (sshbuf_ptr(b) == NULL)
|
||||||
return SSH_ERR_INTERNAL_ERROR;
|
return SSH_ERR_INTERNAL_ERROR;
|
||||||
@ -210,13 +210,12 @@ sshbuf_cmp(const struct sshbuf *b, size_t offset,
|
|||||||
|
|
||||||
int
|
int
|
||||||
sshbuf_find(const struct sshbuf *b, size_t start_offset,
|
sshbuf_find(const struct sshbuf *b, size_t start_offset,
|
||||||
const u_char *s, size_t len, size_t *offsetp)
|
const void *s, size_t len, size_t *offsetp)
|
||||||
{
|
{
|
||||||
void *p;
|
void *p;
|
||||||
|
|
||||||
if (offsetp != NULL)
|
if (offsetp != NULL)
|
||||||
*offsetp = 0;
|
*offsetp = 0;
|
||||||
|
|
||||||
if (sshbuf_ptr(b) == NULL)
|
if (sshbuf_ptr(b) == NULL)
|
||||||
return SSH_ERR_INTERNAL_ERROR;
|
return SSH_ERR_INTERNAL_ERROR;
|
||||||
if (start_offset > SSHBUF_SIZE_MAX || len > SSHBUF_SIZE_MAX || len == 0)
|
if (start_offset > SSHBUF_SIZE_MAX || len > SSHBUF_SIZE_MAX || len == 0)
|
||||||
|
6
sshbuf.h
6
sshbuf.h
@ -1,4 +1,4 @@
|
|||||||
/* $OpenBSD: sshbuf.h,v 1.16 2019/07/16 13:18:39 djm Exp $ */
|
/* $OpenBSD: sshbuf.h,v 1.17 2019/07/30 05:04:49 djm Exp $ */
|
||||||
/*
|
/*
|
||||||
* Copyright (c) 2011 Damien Miller
|
* Copyright (c) 2011 Damien Miller
|
||||||
*
|
*
|
||||||
@ -270,7 +270,7 @@ int sshbuf_b64tod(struct sshbuf *buf, const char *b64);
|
|||||||
* all.
|
* all.
|
||||||
*/
|
*/
|
||||||
int sshbuf_cmp(const struct sshbuf *b, size_t offset,
|
int sshbuf_cmp(const struct sshbuf *b, size_t offset,
|
||||||
const u_char *s, size_t len);
|
const void *s, size_t len);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Searches the buffer for the specified string. Returns 0 on success
|
* Searches the buffer for the specified string. Returns 0 on success
|
||||||
@ -282,7 +282,7 @@ int sshbuf_cmp(const struct sshbuf *b, size_t offset,
|
|||||||
*/
|
*/
|
||||||
int
|
int
|
||||||
sshbuf_find(const struct sshbuf *b, size_t start_offset,
|
sshbuf_find(const struct sshbuf *b, size_t start_offset,
|
||||||
const u_char *s, size_t len, size_t *offsetp);
|
const void *s, size_t len, size_t *offsetp);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Duplicate the contents of a buffer to a string (caller to free).
|
* Duplicate the contents of a buffer to a string (caller to free).
|
||||||
|
Loading…
x
Reference in New Issue
Block a user