[openssh-commits] [openssh] 06/09: upstream: Reorder calloc arguments
git+noreply at mindrot.org
git+noreply at mindrot.org
Thu Aug 15 12:21:06 AEST 2024
This is an automated email from the git hooks/post-receive script.
djm pushed a commit to branch master
in repository openssh.
commit 0af06e2c5b898992a18c74333e75a0136506acc6
Author: tobias at openbsd.org <tobias at openbsd.org>
AuthorDate: Wed Aug 14 15:42:18 2024 +0000
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
---
cipher.c | 4 ++--
sshbuf.c | 6 +++---
2 files changed, 5 insertions(+), 5 deletions(-)
diff --git a/cipher.c b/cipher.c
index f12daa12..9c2fbd6c 100644
--- a/cipher.c
+++ b/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 at cs.hut.fi>
* Copyright (c) 1995 Tatu Ylonen <ylo at 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;
diff --git a/sshbuf.c b/sshbuf.c
index 0ae3095d..1b714e5f 100644
--- a/sshbuf.c
+++ b/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;
--
To stop receiving notification emails like this one, please contact
djm at mindrot.org.
More information about the openssh-commits
mailing list