aboutsummaryrefslogtreecommitdiffstats
path: root/fuzz/htmlSeed.c
blob: f3213e2ec5664b8143d45cfeac426563e6257ba1 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
/*
 * htmlSeed.c: Generate the HTML seed corpus for fuzzing.
 *
 * See Copyright for the status of this software.
 */

#include <stdio.h>

#define SEED_BUF_SIZE 16384

int
main(int argc, char **argv) {
    int opts = 0;
    FILE *file;
    char buf[SEED_BUF_SIZE];
    size_t size;

    if (argc != 2) {
        fprintf(stderr, "Usage: htmlSeed [FILE]\n");
        return(1);
    }

    fwrite(&opts, sizeof(opts), 1, stdout);

    /* Copy file */
    file = fopen(argv[1], "rb");
    do {
        size = fread(buf, 1, SEED_BUF_SIZE, file);
        if (size > 0)
            fwrite(buf, 1, size, stdout);
    } while (size == SEED_BUF_SIZE);
    fclose(file);

    return(0);
}