Created
June 11, 2012 10:50
-
-
Save slava-vishnyakov/2909542 to your computer and use it in GitHub Desktop.
Test mysql
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
* CVE-2012-2122 checker | |
* | |
* You may get differing results with/without -m32 | |
* | |
* Joshua J. Drake | |
*/ | |
#include <stdio.h> | |
#include <stdlib.h> | |
int main(void) { | |
int one, two, ret; | |
time_t start = time(0); | |
time_t now; | |
srand(getpid()*start); | |
while (1) { | |
one = rand(); | |
two = rand(); | |
ret = memcmp(&one, &two, sizeof(int)); | |
if (ret < -128 || ret > 127) | |
break; | |
time(&now); | |
if (now - start > 10) { | |
printf("Not triggered in 10 seconds, *probably* not vulnerable..\n"); | |
return 1; | |
} | |
} | |
printf("Vulnerable! memcmp returned: %d\n", ret); | |
return 0; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment