Skip to content

Commit

Permalink
Fix calloc calls
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]>
  • Loading branch information
AreaZR committed Dec 21, 2023
1 parent acd6f47 commit 2483a7e
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 2483a7e

Please sign in to comment.