Permalink
Browse files

Handle NULL returns from glibc 2.17+ crypt().

Starting with glibc 2.17 (eglibc 2.17), crypt() fails with EINVAL
(w/ NULL return) if the salt violates specifications. Additionally,
on FIPS-140 enabled Linux systems, DES/MD5-encrypted passwords
passed to crypt() fail with EPERM (w/ NULL return).

If using glibc's crypt(), check return value to avoid a possible
NULL pointer dereference.
  • Loading branch information...
1 parent 31e261a commit 178b6f5864489f5ea2e910f68547964c220384f2 @mancha1 mancha1 committed with Jehreg Jul 7, 2013
Showing with 2 additions and 2 deletions.
  1. +2 −2 programs/pluto/xauth.c
@@ -1070,8 +1070,8 @@ int do_md5_authentication(void *varg)
openswan_log("XAUTH: checking user(%s:%s) " , szuser, szconnid);
}
- /* Ok then now password check */
- if ( strcmp(cp, szpass ) == 0 )
+ /* Ok then now password check; Note: handle crypt() NULL returns */
+ if ( cp && strcmp(cp, szpass ) == 0 )
{
/* we have a winner */
fclose( fp );

0 comments on commit 178b6f5

Please sign in to comment.