Skip to content
Snippets Groups Projects

Fix segmentation fault

Merged Fokke Dijkstra requested to merge fokke/pam_2fa:fix/segmentation_fault into master
1 unresolved thread
1 file
+ 4
2
Compare changes
  • Side-by-side
  • Inline
+ 4
2
@@ -218,7 +218,7 @@ int check_2fa(pam_handle_t *pamh, Params *params) {
const char *user = get_user(pamh, params);
if ( user == NULL ) {
rc = params->status;
goto out;
goto out2;
}
// grace period
@@ -232,7 +232,7 @@ int check_2fa(pam_handle_t *pamh, Params *params) {
* so get it
if ( (rc = pam_get_authtok(pamh, PAM_OLDAUTHTOK, &authtok, NULL)) != PAM_SUCCESS ) {
log_message(pamh, INFO, "error retrieving previous passwd");
goto out;
goto out2;
}
* ask for TOTP code N times at most then fail
*/
@@ -244,6 +244,7 @@ int check_2fa(pam_handle_t *pamh, Params *params) {
}
}
out:
out2:
return rc;
#else
AA *aa = calloc(1,sizeof(AA));
@@ -267,6 +268,7 @@ out:
}
out:
aa_destroy(aa); free(aa);
out2:
    • Dus eigenlijk was dit het probleem. Als de code vanuit regel 221 springt dan wordt geprobeerd die niet bestaande buffers te free'en. Dat geeft idd een segfault. Stom. Thanks.

Please register or sign in to reply
if ( rc == 0 ) {
log_message(pamh,INFO,"succeeded totp for \"%s\"",user);
update_grace_period(pamh,params,user);
Loading