blob: 339c031fd382e73d07c3074f4a757511e4fbc694 (
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
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
|
DISTFILES = Makefile \
iri.c
include ../../config.mk
CC = afl-clang
COBJS = ${COMPATS:.c=.o}
REG_COMPATS = ${COBJS:%=../../%}
IRI_SRCS = iri.c ../../iri.c ../../utf8.c ../../log.c
IRI_OBJS = ${IRI_SRCS:.c=.o} ${REG_COMPATS}
PROXY_SRCS = proxy.c ../../proxy-proto.c ../../log.c
PROXY_OBJS = ${PROXY_SRCS:.c=.o} ${REG_COMPATS}
.PHONY: all data clean dist
all:
@echo run ${MAKE} fuzz-iri to fuzz the IRI parser
@echo run ${MAKE} fuzz-proxy to fuzz the proxy v1 protocol parser
fuzz-iri: iri
rm -rf in out
mkdir -p in out
echo 'gemini://omarpolo.com/' > in/simple
echo 'https://op:123@omarpolo.com/' > in/auth
echo 'ftp://op@omarpolo.com/a/bb/c' > in/path
echo 'gemini://omarpolo.com/?some=val' > in/query
echo 'gemini://omarpolo.com/b/#xyz' > in/fragment
echo 'gemini://omarpolo.com/b/?x=y#xyz' > in/qf
echo 'ssh://omarpolo.com/%2F/' > in/enc
echo 'http://omarpolo.com/foo/.././' > in/dots
echo 'http://omarpolo.com/////././' > in/slash
afl-fuzz -i in -o out -- ./iri
fuzz-proxy: proxy
rm -rf in out
mkdir -p in out
printf 'PROXY TCP4 255.255.255.255 255.255.255.255 65535 65535\r\n' >in/ipv4
printf 'PROXY TCP6 fe80::1 fd4b:b287:5c6f:1f4::2 65535 65535\r\n' >in/ipv6
printf 'PROXY UNKNOWN\r\n' > in/unknown
afl-fuzz -i in -o out -- ./proxy
iri: ${IRI_OBJS}
${CC} ${IRI_OBJS} -o $@ ${LIBS} ${LDFLAGS}
proxy: ${PROXY_OBJS}
${CC} ${PROXY_OBJS} -o $@ ${LIBS} ${LDFLAGS}
.c.o:
${CC} -I../.. ${CFLAGS} -c $< -o $@
clean:
rm -f *.o iri
|