From 2483a7e3f105006bac1a927bf14f15ff44f25d4b Mon Sep 17 00:00:00 2001 From: Rose <83477269+AtariDreams@users.noreply.github.com> Date: Thu, 20 Apr 2023 15:02:25 -0400 Subject: [PATCH] Fix calloc calls Size and number are switched in calloc sometimes. This PR fixes that. Signed-off-by: Seija Kijin --- pppd/tdb.c | 2 +- pppd/tls.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/pppd/tdb.c b/pppd/tdb.c index 62644171a..ecbee1f7d 100644 --- a/pppd/tdb.c +++ b/pppd/tdb.c @@ -933,7 +933,7 @@ static int tdb_new_database(TDB_CONTEXT *tdb, int hash_size) /* We make it up in memory, then write it out if not internal */ size = sizeof(struct tdb_header) + (hash_size+1)*sizeof(tdb_off); - if (!(newdb = calloc(size, 1))) + if (!(newdb = calloc(1, size))) return TDB_ERRCODE(TDB_ERR_OOM, -1); /* Fill in the header */ diff --git a/pppd/tls.c b/pppd/tls.c index 8328e207d..d57e434e7 100644 --- a/pppd/tls.c +++ b/pppd/tls.c @@ -235,7 +235,7 @@ int tls_set_verify_info(SSL *ssl, const char *peer_name, const char *peer_cert, bool client, struct tls_info **out) { if (out != NULL) { - struct tls_info *tmp = calloc(sizeof(struct tls_info), 1); + struct tls_info *tmp = calloc(1, sizeof(struct tls_info)); if (!tmp) { fatal("Allocation error"); }