Permalink
Browse files

If, for whatever reason, the 8 rightmost bits of memcmp() return

value are zero, an invalid password might be accepted.
  • Loading branch information...
1 parent d4c7e2f commit 4039781f1d28c2f31086415a9d99aa615ff7df3a Davi Arnaut committed Apr 24, 2012
Showing with 1 addition and 1 deletion.
  1. +1 −1 sql/password.c
View
@@ -531,7 +531,7 @@ check_scramble(const uchar *scramble_arg, const char *message,
mysql_sha1_reset(&sha1_context);
mysql_sha1_input(&sha1_context, buf, SHA1_HASH_SIZE);
mysql_sha1_result(&sha1_context, hash_stage2_reassured);
- return memcmp(hash_stage2, hash_stage2_reassured, SHA1_HASH_SIZE);
+ return test(memcmp(hash_stage2, hash_stage2_reassured, SHA1_HASH_SIZE));
}

0 comments on commit 4039781

Please sign in to comment.