Skip to content

Commit

Permalink
pppd: Fix calloc calls (#416)
Browse files Browse the repository at this point in the history
Size and number are switched in calloc sometimes. This PR fixes that.

Signed-off-by: Seija Kijin <[email protected]>
Co-authored-by: Seija Kijin <[email protected]>
  • Loading branch information
AreaZR and DTeachs authored Dec 26, 2023
1 parent acd6f47 commit 9ec68f3
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion pppd/tdb.c
Original file line number Diff line number Diff line change
Expand Up @@ -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 */
Expand Down
2 changes: 1 addition & 1 deletion pppd/tls.c
Original file line number Diff line number Diff line change
Expand Up @@ -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");
}
Expand Down

0 comments on commit 9ec68f3

Please sign in to comment.