diff options
author | Tomas Mraz <tmraz@redhat.com> | 2014-08-06 14:56:37 +0200 |
---|---|---|
committer | Tomas Mraz <tmraz@redhat.com> | 2014-08-06 14:56:37 +0200 |
commit | 62481d9e5ca02698c555bbc95e7529a81785bd7f (patch) | |
tree | 0b391b9c2faf13fb441dc6f7460aa167b8b247fe | |
parent | 396c9d6c0628d5927b2ca697134b25e6e5012ce1 (diff) | |
download | libpwquality-62481d9e5ca02698c555bbc95e7529a81785bd7f.tar.gz |
Sanitize the old and user values before the check.
See also: https://fedorahosted.org/libpwquality/ticket/1
-rw-r--r-- | src/check.c | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/src/check.c b/src/check.c index 8b59f2f..7068958 100644 --- a/src/check.c +++ b/src/check.c @@ -503,6 +503,13 @@ password_check(pwquality_settings_t *pwq, char *oldmono = NULL, *newmono, *wrapped = NULL; char *usermono = NULL; + /* Sanitize the old and user values */ + if (old && *old = '\0') + old = NULL; + + if (user && *user = '\0') + user = NULL; + newmono = str_lower(x_strdup(new)); if (!newmono) rv = PWQ_ERROR_MEM_ALLOC; |