From 069671179ebc737651dc63c38fe2ef76b3aa3620 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: Rose <83477269+AtariDreams@users.noreply.github.com> --- 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 8a563f88b..3aca4575a 100644 --- a/pppd/tdb.c +++ b/pppd/tdb.c @@ -930,7 +930,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"); }