mirror of git://anongit.mindrot.org/openssh.git
upstream: Reorder calloc arguments
The first argument should be the amount, the second argument should be the element size. Fixing this also silences some gcc compiler warnings for portable. Spotted with Benny Baumann (BenBE at geshi dot org). ok djm@ OpenBSD-Commit-ID: 711ad6f7bd7fb48bf52208f2cf9f108cddb6d41a
This commit is contained in:
parent
56ce0aa3c6
commit
0af06e2c5b
4
cipher.c
4
cipher.c
|
@ -1,4 +1,4 @@
|
|||
/* $OpenBSD: cipher.c,v 1.121 2024/05/17 02:39:11 jsg Exp $ */
|
||||
/* $OpenBSD: cipher.c,v 1.122 2024/08/14 15:42:18 tobias Exp $ */
|
||||
/*
|
||||
* Author: Tatu Ylonen <ylo@cs.hut.fi>
|
||||
* Copyright (c) 1995 Tatu Ylonen <ylo@cs.hut.fi>, Espoo, Finland
|
||||
|
@ -255,7 +255,7 @@ cipher_init(struct sshcipher_ctx **ccp, const struct sshcipher *cipher,
|
|||
#endif
|
||||
|
||||
*ccp = NULL;
|
||||
if ((cc = calloc(sizeof(*cc), 1)) == NULL)
|
||||
if ((cc = calloc(1, sizeof(*cc))) == NULL)
|
||||
return SSH_ERR_ALLOC_FAIL;
|
||||
|
||||
cc->plaintext = (cipher->flags & CFLAG_NONE) != 0;
|
||||
|
|
6
sshbuf.c
6
sshbuf.c
|
@ -1,4 +1,4 @@
|
|||
/* $OpenBSD: sshbuf.c,v 1.22 2024/08/14 15:40:30 tobias Exp $ */
|
||||
/* $OpenBSD: sshbuf.c,v 1.23 2024/08/14 15:42:18 tobias Exp $ */
|
||||
/*
|
||||
* Copyright (c) 2011 Damien Miller
|
||||
*
|
||||
|
@ -94,7 +94,7 @@ sshbuf_new(void)
|
|||
{
|
||||
struct sshbuf *ret;
|
||||
|
||||
if ((ret = calloc(sizeof(*ret), 1)) == NULL)
|
||||
if ((ret = calloc(1, sizeof(*ret))) == NULL)
|
||||
return NULL;
|
||||
ret->alloc = SSHBUF_SIZE_INIT;
|
||||
ret->max_size = SSHBUF_SIZE_MAX;
|
||||
|
@ -114,7 +114,7 @@ sshbuf_from(const void *blob, size_t len)
|
|||
struct sshbuf *ret;
|
||||
|
||||
if (blob == NULL || len > SSHBUF_SIZE_MAX ||
|
||||
(ret = calloc(sizeof(*ret), 1)) == NULL)
|
||||
(ret = calloc(1, sizeof(*ret))) == NULL)
|
||||
return NULL;
|
||||
ret->alloc = ret->size = ret->max_size = len;
|
||||
ret->readonly = 1;
|
||||
|
|
Loading…
Reference in New Issue