Memory leak while parsing a crafted torrc
There is a memory leak while tor parses a crafted config.
~ # tor --verify-config -f $CRAFTED_TORRC Jun 20 15:59:36.509 [notice] Tor v0.2.7.6 running on Linux with Libevent 2.0.22-stable, OpenSSL 1.0.2h and Zlib 1.2.8. Jun 20 15:59:36.531 [notice] Tor can't help you if you use it wrong! Learn how to be safe at https://www.torproject.org/download/download#warning Jun 20 15:59:36.531 [notice] Read configuration file "/tmp/afl/out/AFL0/crashes/id:000041,sig:06,src:000000,op:havoc,rep:32". Jun 20 15:59:36.553 [warn] The abbreviation 'no' is deprecated. Please use 'NodeFamily' instead Jun 20 15:59:36.571 [warn] Entry 'kltorpc ' in NodeFamily is malformed. Discarding entire list. Jun 20 15:59:36.572 [warn] Entry 'kltorpc ' in NodeFamily is malformed. Discarding entire list. Jun 20 15:59:36.572 [err] Reading config failed--see warnings above.
================================================================= ==28441==ERROR: LeakSanitizer: detected memory leaks
Direct leak of 16 byte(s) in 1 object(s) allocated from: #0 0x4eb568 in malloc (/usr/bin/tor+0x4eb568) #1 0x9fbc6b in tor_malloc_ /tmp/portage/net-misc/tor-0.2.7.6/work/tor-0.2.7.6/src/common/util.c:171:12 #2 (closed) 0x9c7b82 in smartlist_new /tmp/portage/net-misc/tor-0.2.7.6/work/tor-0.2.7.6/src/common/container.c:34:21 #3 (closed) 0x7e73fe in options_init_from_string /tmp/portage/net-misc/tor-0.2.7.6/work/tor-0.2.7.6/src/or/config.c:4720:7 #4 (closed) 0x7e4f09 in options_init_from_torrc /tmp/portage/net-misc/tor-0.2.7.6/work/tor-0.2.7.6/src/or/config.c:4524:12 #5 (closed) 0x52cf11 in tor_init /tmp/portage/net-misc/tor-0.2.7.6/work/tor-0.2.7.6/src/or/main.c:2709:7 #6 (closed) 0x52e2a6 in tor_main /tmp/portage/net-misc/tor-0.2.7.6/work/tor-0.2.7.6/src/or/main.c:3271:7 #7 (closed) 0x51c51d in main /tmp/portage/net-misc/tor-0.2.7.6/work/tor-0.2.7.6/src/or/tor_main.c:30:11 #8 (closed) 0x444018 in _start (/usr/bin/tor+0x444018)
Indirect leak of 128 byte(s) in 1 object(s) allocated from: #0 0x4eb568 in malloc (/usr/bin/tor+0x4eb568) #1 0x9fbc6b in tor_malloc_ /tmp/portage/net-misc/tor-0.2.7.6/work/tor-0.2.7.6/src/common/util.c:171:12 #2 (closed) 0x9fc050 in tor_malloc_zero_ /tmp/portage/net-misc/tor-0.2.7.6/work/tor-0.2.7.6/src/common/util.c:197:18 #3 (closed) 0x9fc050 in tor_calloc_ /tmp/portage/net-misc/tor-0.2.7.6/work/tor-0.2.7.6/src/common/util.c:235 #4 (closed) 0x9c7c0d in smartlist_new /tmp/portage/net-misc/tor-0.2.7.6/work/tor-0.2.7.6/src/common/container.c:37:14 #5 (closed) 0x7e73fe in options_init_from_string /tmp/portage/net-misc/tor-0.2.7.6/work/tor-0.2.7.6/src/or/config.c:4720:7 #6 (closed) 0x7e4f09 in options_init_from_torrc /tmp/portage/net-misc/tor-0.2.7.6/work/tor-0.2.7.6/src/or/config.c:4524:12 #7 (closed) 0x52cf11 in tor_init /tmp/portage/net-misc/tor-0.2.7.6/work/tor-0.2.7.6/src/or/main.c:2709:7 #8 (closed) 0x52e2a6 in tor_main /tmp/portage/net-misc/tor-0.2.7.6/work/tor-0.2.7.6/src/or/main.c:3271:7 #9 (closed) 0x51c51d in main /tmp/portage/net-misc/tor-0.2.7.6/work/tor-0.2.7.6/src/or/tor_main.c:30:11 #10 (closed) 0x444018 in _start (/usr/bin/tor+0x444018)
SUMMARY: AddressSanitizer: 144 byte(s) leaked in 2 allocation(s).
Trac:
Username: asarubbo