Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fuzzer mods #328

Merged
merged 2 commits into from
Dec 17, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions fuzz/fuzz_auth.c
Original file line number Diff line number Diff line change
Expand Up @@ -164,6 +164,8 @@ static void consume(const void *body, size_t len) {

while (len--)
x ^= *ptr++;

(void) x;
}

static int conv_cb(int num_msg, const struct pam_message **msg,
Expand Down
13 changes: 11 additions & 2 deletions fuzz/wrap.c
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
#include <openssl/ec.h>
#include <fido.h>

#include "debug.h"
#include "drop_privs.h"
#include "fuzz/fuzz.h"

Expand Down Expand Up @@ -65,7 +66,6 @@ WRAP(int, gethostname, (char *name, size_t len), -1, (name, len))
WRAP(ssize_t, getline, (char **s, size_t *n, FILE *fp), -1, (s, n, fp))
WRAP(FILE *, fdopen, (int fd, const char *mode), NULL, (fd, mode))
WRAP(int, fstat, (int fd, struct stat *st), -1, (fd, st))
WRAP(ssize_t, read, (int fd, void *buf, size_t count), -1, (fd, buf, count))
WRAP(BIO *, BIO_new, (const BIO_METHOD *type), NULL, (type))
WRAP(int, BIO_write, (BIO * b, const void *data, int len), -1, (b, data, len))
WRAP(int, BIO_read, (BIO * b, void *data, int len), -1, (b, data, len))
Expand All @@ -75,7 +75,16 @@ WRAP(BIO *, BIO_new_mem_buf, (const void *buf, int len), NULL, (buf, len))
WRAP(EC_KEY *, EC_KEY_new_by_curve_name, (int nid), NULL, (nid))
WRAP(const EC_GROUP *, EC_KEY_get0_group, (const EC_KEY *key), NULL, (key))

extern int __wrap_asprintf(char **strp, const char *fmt, ...);
extern ssize_t __real_read(int fildes, void *buf, size_t nbyte);
extern ssize_t __wrap_read(int fildes, void *buf, size_t nbyte);
extern ssize_t __wrap_read(int fildes, void *buf, size_t nbyte) {
assert(fildes >= 0);
assert(buf != NULL);
return __real_read(fildes, buf, nbyte);
}

extern int __wrap_asprintf(char **strp, const char *fmt, ...)
ATTRIBUTE_FORMAT(printf, 2, 3);
extern int __wrap_asprintf(char **strp, const char *fmt, ...) {
va_list ap;
int r;
Expand Down
Loading