From 35f44a1aebe0350884113c0ce57c2aeb736c714b Mon Sep 17 00:00:00 2001 From: Rob Crittenden Date: Mon, 9 Apr 2012 23:42:41 -0400 Subject: 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 --- util/ipa_pwd.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'util') diff --git a/util/ipa_pwd.c b/util/ipa_pwd.c index b6ed929b3..92fb3b029 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 -- cgit