auth: Don't crash if UserList contains bogus line
authorSimon Wilkinson <sxw@your-file-system.com>
Sat, 1 Jan 2011 23:58:20 +0000 (23:58 +0000)
committerJeffrey Altman <jaltman@openafs.org>
Sun, 2 Jan 2011 03:18:43 +0000 (19:18 -0800)
If the first line of the UserList was bogus (caused ParseLine to
return an error), then we would attempt to free the contents of
an uninitialised identity structure, and crash. Initialise the
structure so this no longer happens.

Change-Id: I55074a5eb616ac48d8a278db2d8389d3b0e112a6
Reviewed-on: http://gerrit.openafs.org/3607
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Jeffrey Altman <jaltman@openafs.org>
Tested-by: Jeffrey Altman <jaltman@openafs.org>

src/auth/userok.c

index efd488a..a8ee672 100644 (file)
@@ -159,6 +159,8 @@ afsconf_DeleteIdentity(struct afsconf_dir *adir, struct rx_identity *user)
     struct rx_identity identity;
     afs_int32 code;
 
+    memset(&identity, 0, sizeof(struct rx_identity));
+
     LOCK_GLOBAL_MUTEX;
     UserListFileName(adir, tbuffer, sizeof tbuffer);
 #ifndef AFS_NT40_ENV