From: Tomas Mraz Date: Mon, 4 Apr 2005 09:46:10 +0000 (+0000) Subject: Relevant BUGIDs: X-Git-Tag: Linux-PAM-0-80~26 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=8ebbc8468fb42237a36f8aaba2434f72ec152ef5;p=linux-pam Relevant BUGIDs: Purpose of commit: bugfix Commit summary: --------------- Test for NULL data before dereferencing them --- diff --git a/CHANGELOG b/CHANGELOG index 7cb6dd45..d49e4b12 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -62,6 +62,7 @@ BerliOS Bugs are marked with (BerliOS #XXXX). 0.80: please submit patches for this section with actual code/doc patches! +* pam_tally: test for NULL data before dereferencing them (t8m) 0.79: Thu Mar 31 16:48:45 CEST 2005 * pam_tally: added audit option (toady) diff --git a/modules/pam_tally/pam_tally.c b/modules/pam_tally/pam_tally.c index 57fa611a..2ea38810 100644 --- a/modules/pam_tally/pam_tally.c +++ b/modules/pam_tally/pam_tally.c @@ -268,7 +268,7 @@ static int tally_get_data( pam_handle_t *pamh, time_t *oldtime ) const void *data; rv = pam_get_data(pamh, MODULE_NAME, &data); - if ( rv == PAM_SUCCESS && oldtime != NULL ) { + if ( rv == PAM_SUCCESS && data != NULL && oldtime != NULL ) { *oldtime = *(const time_t *)data; pam_set_data(pamh, MODULE_NAME, NULL, NULL); } @@ -423,6 +423,7 @@ static int tally_bump (int inc, time_t *oldtime, int i; i=get_tally( &tally, uid, opts->filename, &TALLY, fsp ); + if ( i != PAM_SUCCESS ) { if (TALLY) fclose(TALLY); RETURN_ERROR( i ); } /* to remember old fail time (for locktime) */ fsp->fs_fail_time = fsp->fs_faillog.fail_time; @@ -455,7 +456,6 @@ static int tally_bump (int inc, time_t *oldtime, (size_t)sizeof(fsp->fs_faillog.fail_line)); fsp->fs_faillog.fail_line[sizeof(fsp->fs_faillog.fail_line)-1] = 0; } - if ( i != PAM_SUCCESS ) { if (TALLY) fclose(TALLY); RETURN_ERROR( i ); } if ( !(opts->ctrl & OPT_MAGIC_ROOT) || getuid() ) { /* magic_root doesn't change tally */