Skip to content

Commit

Permalink
Avoid passing pointer to a structure that might be already out
Browse files Browse the repository at this point in the history
of scope. This might potentially fix crashing issue reported here:

http://lists.opensips.org/pipermail/users/2021-September/045122.html
  • Loading branch information
sobomax committed Sep 27, 2021
1 parent 4c87a29 commit fea6a1d
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion modules/auth_db/authorize.c
Expand Up @@ -154,11 +154,13 @@ static inline int get_ha1(dig_cred_t* digest, const str* _domain,
result.len = strlen(result.s);

struct calc_HA1_arg cprms = {.alg = digest->alg.alg_parsed};
struct digest_auth_credential ocreds;
if (calc_ha1) {
/* Only plaintext passwords are stored in database,
* we have to calculate HA1 */
cprms.creds.open = &(const struct digest_auth_credential){
ocreds = (struct digest_auth_credential){
.realm = *_domain, .user = _username->whole, .passwd = result};
cprms.creds.open = &ocreds;
cprms.use_hashed = 0;
} else {
cprms.creds.ha1 = &result;
Expand Down

0 comments on commit fea6a1d

Please sign in to comment.