Skip to content

common: fix pointer-before-start UB in drop_incomplete_utf8#916

Open
dxbjavid wants to merge 1 commit into
avahi:masterfrom
dxbjavid:common-alternative-fix-ptr-before-start
Open

common: fix pointer-before-start UB in drop_incomplete_utf8#916
dxbjavid wants to merge 1 commit into
avahi:masterfrom
dxbjavid:common-alternative-fix-ptr-before-start

Conversation

@dxbjavid
Copy link
Copy Markdown
Contributor

drop_incomplete_utf8() computes strchr(c, 0) - 1, which is undefined
when c is empty. The empty case is reached from
avahi_alternative_service_name(" #N") and avahi_alternative_host_name("-N")
via avahi_strndup(s, 0); fuzz-domain exercises both entry points.

drop_incomplete_utf8() computes strchr(c, 0) - 1, which is undefined
when c is empty. The empty case is reached from
avahi_alternative_service_name(" #N") and avahi_alternative_host_name("-N")
via avahi_strndup(s, 0); fuzz-domain exercises both entry points.
@evverx
Copy link
Copy Markdown
Collaborator

evverx commented May 22, 2026

As mentioned in another PR one-off fixes with no tests aren't considered especially in cases like this where tests are straightforward. I'll keep it open as a bug report though. Generally it would probably be better to open issues first and mention how issues are discovered along with all the details like the tooling, *san/Valgrind backtraces, the output of static analyzers and their names or anything like that.

I'll also point to https://github.com/avahi/avahi/blob/master/.github/CONTRIBUTING.md again

Our golden rule is that a contribution should be worth more to the project than the time it takes to review it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants