================================================================= ==5061==ERROR: AddressSanitizer: stack-buffer-overflow on address 0xf0efc230033a at pc 0xf0efc4485124 bp 0xffffee420bd0 sp 0xffffee4203b0 WRITE of size 300 at 0xf0efc230033a thread T0 #0 0xf0efc4485120 in memcpy ../../../../src/libsanitizer/sanitizer_common/sanitizer_common_interceptors_memintrinsics.inc:115 #1 0xc484c5001134 in build_txt_record src/dns.c:390 #2 0xc484c5002814 in handle_mdns_query src/dns.c:496 #3 0xc484c5003aa8 in handle_mdns_record src/dns.c:575 #4 0xc484c5003b78 in mdns_cb src/dns.c:584 #5 0xc484c5003e98 in mg_call src/event.c:21 #6 0xc484c5039378 in iolog src/sock.c:133 #7 0xc484c503b68c in read_conn src/sock.c:362 #8 0xc484c50406b4 in mg_mgr_poll src/sock.c:783 #9 0xc484c504cc20 in main /data/pruva/runs/17a15ce6-4969-4882-9c55-0a227b0d8ef1/mongoose/tutorials/udp/mdns-sd-server/test_vuln.c:37 #10 0xf0efc42084c0 (/lib/aarch64-linux-gnu/libc.so.6+0x284c0) (BuildId: d6c205bda1b6e91815f8fef45bdf56bc2239c37e) #11 0xf0efc4208594 in __libc_start_main (/lib/aarch64-linux-gnu/libc.so.6+0x28594) (BuildId: d6c205bda1b6e91815f8fef45bdf56bc2239c37e) #12 0xc484c4ffb1ac in _start (/data/pruva/runs/17a15ce6-4969-4882-9c55-0a227b0d8ef1/logs/test_vuln+0xb1ac) (BuildId: 37daaf260fa14a79b1d8c1f1a88d83f83f542357) Address 0xf0efc230033a is located in stack of thread T0 at offset 826 in frame #0 0xc484c50011d0 in handle_mdns_query src/dns.c:396 This frame has 7 object(s): [32, 34) 'offset' (line 480) [48, 50) 'offset' (line 506) [64, 72) 'rr' (line 398) [96, 112) 'defname' (line 411) [128, 192) 'req' (line 413) [224, 480) 'name' (line 408) [544, 826) 'buf' (line 405) <== Memory access at offset 826 overflows this variable HINT: this may be a false positive if your program uses some custom stack unwind mechanism, swapcontext or vfork (longjmp and C++ exceptions *are* supported) SUMMARY: AddressSanitizer: stack-buffer-overflow ../../../../src/libsanitizer/sanitizer_common/sanitizer_common_interceptors_memintrinsics.inc:115 in memcpy Shadow bytes around the buggy address: 0xf0efc2300080: 00 00 00 00 00 00 00 00 f2 f2 f2 f2 00 00 00 00 0xf0efc2300100: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 0xf0efc2300180: 00 00 00 00 00 00 00 00 00 00 00 00 f2 f2 f2 f2 0xf0efc2300200: f2 f2 f2 f2 00 00 00 00 00 00 00 00 00 00 00 00 0xf0efc2300280: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 =>0xf0efc2300300: 00 00 00 00 00 00 00[02]f3 f3 f3 f3 f3 f3 f3 f3 0xf0efc2300380: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 0xf0efc2300400: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 0xf0efc2300480: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 0xf0efc2300500: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 0xf0efc2300580: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 Shadow byte legend (one shadow byte represents 8 application bytes): Addressable: 00 Partially addressable: 01 02 03 04 05 06 07 Heap left redzone: fa Freed heap region: fd Stack left redzone: f1 Stack mid redzone: f2 Stack right redzone: f3 Stack after return: f5 Stack use after scope: f8 Global redzone: f9 Global init order: f6 Poisoned by user: f7 Container overflow: fc Array cookie: ac Intra object redzone: bb ASan internal: fe Left alloca redzone: ca Right alloca redzone: cb ==5061==ABORTING