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

getnameinfo() crashing smol_pkts #5

Open
svaniksharma opened this issue Jan 30, 2020 · 1 comment
Open

getnameinfo() crashing smol_pkts #5

svaniksharma opened this issue Jan 30, 2020 · 1 comment

Comments

@svaniksharma
Copy link
Owner

There's this error happening where getnameinfo() crashes the program. I'm not sure precisely where it originates from, but it appears to be from the getnameinfo() internals. I've tried using a host_map linked list to save us from making too many DNS requests on the network, but to no avail.

@svaniksharma
Copy link
Owner Author

The following is a trace obtained from lldb:

thread #1, queue = 'com.apple.main-thread', stop reason = signal SIGABRT
  * frame #0: 0x00007fff66af67fa libsystem_kernel.dylib`__pthread_kill + 10
    frame #1: 0x00007fff66bb3bc1 libsystem_pthread.dylib`pthread_kill + 432
    frame #2: 0x00007fff66a7da1c libsystem_c.dylib`abort + 120
    frame #3: 0x00007fff66b73647 libsystem_malloc.dylib`malloc_vreport + 548
    frame #4: 0x00007fff66b84d3f libsystem_malloc.dylib`malloc_zone_error + 183
    frame #5: 0x00007fff66b6b179 libsystem_malloc.dylib`tiny_free_list_add_ptr + 1233
    frame #6: 0x00007fff66b68274 libsystem_malloc.dylib`tiny_malloc_from_free_list + 1588
    frame #7: 0x00007fff66b67656 libsystem_malloc.dylib`tiny_malloc_should_clear + 272
    frame #8: 0x00007fff66b662ae libsystem_malloc.dylib`szone_malloc_should_clear + 66
    frame #9: 0x00007fff66b6506a libsystem_malloc.dylib`malloc_zone_malloc + 104
    frame #10: 0x00007fff66b64fe5 libsystem_malloc.dylib`malloc + 21
    frame #11: 0x00007fff66a98ca2 libsystem_dnssd.dylib`create_hdr + 93
    frame #12: 0x00007fff66a9a097 libsystem_dnssd.dylib`DNSServiceRefDeallocate + 139
    frame #13: 0x00007fff66ab62f4 libsystem_info.dylib`_mdns_query_clear + 116
    frame #14: 0x00007fff66ab4056 libsystem_info.dylib`_mdns_search_ex + 5174
    frame #15: 0x00007fff66ab9dc0 libsystem_info.dylib`mdns_hostbyaddr + 880
    frame #16: 0x00007fff66ab981a libsystem_info.dylib`si_host_byaddr + 122
    frame #17: 0x00007fff66ab9929 libsystem_info.dylib`search_host_byaddr + 249
    frame #18: 0x00007fff66ab981a libsystem_info.dylib`si_host_byaddr + 122
    frame #19: 0x00007fff66aafcd4 libsystem_info.dylib`si_nameinfo + 1332
    frame #20: 0x00007fff66aaf5af libsystem_info.dylib`_getnameinfo_interface_internal + 223
    frame #21: 0x00007fff66aaf4bf libsystem_info.dylib`getnameinfo + 175
    frame #22: 0x00000001000019a2 smol_pkts`resolve_name(ip_str="192.168.1.255") at hostname_resolution.c:18:7
    frame #23: 0x00000001000013f4 smol_pkts`print_ip_addr(addr=4278298816, end=" ") at pkt.c:215:16
    frame #24: 0x000000010000134a smol_pkts`process_ip(data="E") at pkt.c:162:3
    frame #25: 0x0000000100001302 smol_pkts`process_ether(data="������\x8c\x85\x90\x9b�) at pkt.c:155:3
    frame #26: 0x00000001000011d8 smol_pkts`process_pkt(bytes_read=76, data="\x14Y2^�) at pkt.c:137:5
    frame #27: 0x00000001000010d7 smol_pkts`event_loop(device_name="en0") at pkt.c:115:7
    frame #28: 0x0000000100001b7c smol_pkts`main(argc=3, argv=0x00007ffeefbff598) at smol_pkts.c:36:3
    frame #29: 0x00007fff669af7fd libdyld.dylib`start + 1
    frame #30: 0x00007fff669af7fd libdyld.dylib`start + 1

As you can see, getnameinfo()'s internals appear to cause the crash.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant