summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRob Crittenden <rcritten@redhat.com>2012-04-09 23:42:41 -0400
committerMartin Kosek <mkosek@redhat.com>2012-04-10 18:33:14 +0200
commita570cef67f117471839bdca01cc79a64e546582f (patch)
treefb7eb96072d97c30b44d4abc801a08747b7cefad
parent3f1d0e6f1459ec86a4fdd97a0df1f2be982ac71e (diff)
downloadfreeipa.git-a570cef67f117471839bdca01cc79a64e546582f.tar.gz
freeipa.git-a570cef67f117471839bdca01cc79a64e546582f.tar.xz
freeipa.git-a570cef67f117471839bdca01cc79a64e546582f.zip
Dereference pointer when comparing password history in qsort compare.
The man page for qsort(3) says that the comparison function is called with pointers to pointers to char but memcmp(3) wants a pointer to void so we need to cast and dereference. Without this the qsort() call wasn't properly sorting the elements so a random password was being removed rather than the oldest when the list overflowed. https://fedorahosted.org/freeipa/ticket/2613
-rw-r--r--util/ipa_pwd.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/util/ipa_pwd.c b/util/ipa_pwd.c
index b6ed929b..92fb3b02 100644
--- a/util/ipa_pwd.c
+++ b/util/ipa_pwd.c
@@ -152,7 +152,7 @@ static int ipapwd_gentime_cmp(const void *p1, const void *p2)
* a higher letter or number */
/* return youngest first by inverting terms */
- return memcmp(p2, p1, GENERALIZED_TIME_LENGTH);
+ return memcmp(*(void * const *)p2, *(void * const *)p1, GENERALIZED_TIME_LENGTH);
}
#define SHA_SALT_LENGTH 8