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

app crashes when trying to browse to a site advertising a TXT record #8

Open
JensEggers opened this issue Jun 25, 2024 · 6 comments
Open

Comments

@JensEggers
Copy link

Hi, very handy tool this!

I find that the tool works perfectly as long as there is no data in the TXT record. Any contents at all seem to make it crash when attempting to browse to a site advertising a TXT record.

@plan44
Copy link
Owner

plan44 commented Jun 25, 2024

Hi @JensEggers,

Are you sure it is the TXT record? Because I tried to reproduce the issue and created a _http._tcp service with a TXT record on one of my avahi hosts, and both LocalSites for macOS and iOS have no problem with that.

Actually, testing that I realized all devices I use LocalSites most with actually do have a TXT record called "path", this is a standard way to advertise not just the host, but also the path part of an URL.

LocalSite does check the TXT records and looks for "path". I don't see a bug in that code (SitesMenuController.swift:247 ff) right now, but maybe there's something specific to your TXT records? Could you post an example of a service that makes LocalSites crash?

@JensEggers
Copy link
Author

Hi, it could be that I'm encoding the TXT wrong - I'll fiddle a bit longer and let you know what I find

@JensEggers
Copy link
Author

Are you expecting a certain encoding (eg RFC 6763)?

@plan44
Copy link
Owner

plan44 commented Jun 25, 2024

Hi, it could be that I'm encoding the TXT wrong - I'll fiddle a bit longer and let you know what I find

Ok, but certainly LocalSites should not crash even when encoding is wrong 😉

Are you expecting a certain encoding (eg RFC 6763)?

Looking at the code I see that I expect the value in TXT records to be valid UTF8, however only for the "path" record. The code is not looking at anything other that "path".

@plan44
Copy link
Owner

plan44 commented Jun 25, 2024

Anyway, can you post an example (avahi .service file if you have that, maybe) that generates the crash? I'd like to understand and guard against the crash in any case

@JensEggers
Copy link
Author

JensEggers commented Jun 25, 2024

Here's a Wireshark record of a packet that will cause LocalSites to crash - but only when clicking on the discovered entry to browse to it. The text record is simply "hello", which is preceded by the normal length fields. It doesn't contain the normally-expected = sign. I was messing around with https://www.npmjs.com/package/multicast-dns trying to get my own information into the TXT record and found the crash.

Now that I'm encoding the TXT properly as name/value pairs LocalSites is holding up just fine 🥇

LocalSites crash.pcapng.zip

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

2 participants