]> git.ozlabs.org Git - ppp.git/commitdiff
pppd: Fix calloc calls (#416)
authorAtariDreams <83477269+AtariDreams@users.noreply.github.com>
Tue, 26 Dec 2023 18:22:23 +0000 (13:22 -0500)
committerGitHub <noreply@github.com>
Tue, 26 Dec 2023 18:22:23 +0000 (18:22 +0000)
Size and number are switched in calloc sometimes. This PR fixes that.

Signed-off-by: Seija Kijin <doremylover123@gmail.com>
Co-authored-by: Seija Kijin <doremylover123@gmail.com>
pppd/tdb.c
pppd/tls.c

index 62644171aa6ed8eee736bcde7e9ff13350207b01..ecbee1f7dcecde8501ba28cdd3f4fd5c0f32626e 100644 (file)
@@ -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 */
index 8328e207dd866860b865dd3c9565b3ce427c96d6..d57e434e734a7e9a0fd0fed38fc6cbe5ebf40d30 100644 (file)
@@ -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");
         }