
* move windows, inprocess fork to a different file, try new hook mechanism for the executor * fix * even more * more * more * fix * fix * macosgit add -ugit add -u * windows! * windows! * aa * aa * macos * std * wtf unresolved? * Copy, Clone * why you just don't have the same API! * inproc * next; inprocess * windows? * ci * ci * ci * unused * ci * unused * no_std * windows no std * fix * inprocess * fix * windows * fuzzers * macos , book * fix * aa * allow * fix * stop suggesting wrong lint AAAAAAAAAAAAAAAAA!!! * stop suggesting wrong lint AAAAAAAAAAAAAAAAA!!! * win * fix * wip * wip2 * windows done? * remove TimeoutExecutor * ci * ci * miri * fixfi * compile on windows * a * clp * no_std stuff * windows no_std * mac stuff * m * a * ci * ci * deleting timeoutexecutor, gradually * fucking macos * ci * test * ci * ci * batch mode constructor * fix * ci * aa * miri * aaa * tmate again * fix windows stuff * final fix * another win fix * add * let's add the new fix later * more * fi * parse * win clippy * win no std * safety * fix * DEFAULT * final fix * libafl_libfuzzer * comments * fix * fix fuzzres * fixxxxx * fixxxxx * last fix * change name
61 lines
1.3 KiB
C
61 lines
1.3 KiB
C
#include <sqlite3.h>
|
|
#include <stdio.h>
|
|
#include <unistd.h>
|
|
#include <string.h>
|
|
#include <stdlib.h>
|
|
|
|
static int callback(void *NotUsed, int argc, char **argv, char **azColName) {
|
|
int i;
|
|
for (i = 0; i < argc; i++) {
|
|
printf("%s=%s ", azColName[i], argv[i] ? argv[i] : "NULL");
|
|
}
|
|
printf("\n");
|
|
return 0;
|
|
}
|
|
|
|
int LLVMFuzzerTestOneInput(char *data, size_t len) {
|
|
sqlite3 *db;
|
|
char *err_msg = 0, query[1024];
|
|
|
|
if (data[0] % 2) {
|
|
int rc = sqlite3_open_v2("example.db", &db, SQLITE_OPEN_READONLY, 0);
|
|
if (rc != SQLITE_OK) {
|
|
fprintf(stderr, "Cannot open database: %s\n", sqlite3_errmsg(db));
|
|
sqlite3_close(db);
|
|
return 1;
|
|
}
|
|
|
|
snprintf(
|
|
query, sizeof(query),
|
|
"SELECT * FROM MyTable where user = \"user1\" and password = \"%s\"",
|
|
data);
|
|
|
|
rc = sqlite3_exec(db, query, callback, 0, &err_msg);
|
|
|
|
if (rc != SQLITE_OK) { sqlite3_free(err_msg); }
|
|
|
|
sqlite3_close(db);
|
|
|
|
} else {
|
|
snprintf(query, sizeof(query), "/usr/bin/id \"%s\"", data);
|
|
system(query);
|
|
}
|
|
|
|
return 0;
|
|
}
|
|
|
|
int main(int argc, char **argv) {
|
|
char pw[16];
|
|
ssize_t len = 1;
|
|
|
|
memset(pw, 0, sizeof(pw));
|
|
if (argc > 1) {
|
|
if ((len = read(0, pw, sizeof(pw) - 1)) < 4) {
|
|
fprintf(stderr, "Error: short read from stdin\n");
|
|
return -1;
|
|
}
|
|
}
|
|
|
|
return LLVMFuzzerTestOneInput(pw, (size_t)len + 1);
|
|
}
|