From 9ec68f3690b25b968d4ddf1ef316f82e8a61667d Mon Sep 17 00:00:00 2001 From: AtariDreams <83477269+AtariDreams@users.noreply.github.com> Date: Tue, 26 Dec 2023 13:22:23 -0500 Subject: [PATCH] pppd: Fix calloc calls (#416) Size and number are switched in calloc sometimes. This PR fixes that. Signed-off-by: Seija Kijin Co-authored-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 6264417..ecbee1f 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 8328e20..d57e434 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"); } -- 2.39.2