]> granicus.if.org Git - linux-pam/commitdiff
Relevant BUGIDs:
authorTomas Mraz <tm@t8m.info>
Mon, 4 Apr 2005 09:46:10 +0000 (09:46 +0000)
committerTomas Mraz <tm@t8m.info>
Mon, 4 Apr 2005 09:46:10 +0000 (09:46 +0000)
Purpose of commit: bugfix

Commit summary:
---------------
Test for NULL data before dereferencing them

CHANGELOG
modules/pam_tally/pam_tally.c

index 7cb6dd45c4ed67aa8edf44a9f7c59f88f5b5df29..d49e4b128367678114e553bfa64db73c9c97fbf8 100644 (file)
--- 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)
index 57fa611ab59482063f20116468fbe6bd7762e2d7..2ea38810a38df7e52ebd3cb3b63ddecb5742badf 100644 (file)
@@ -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 */