>and this code returns garbage and invokes undefined behavior for
>most inputs if `match' points to an empty string
True.

>a possibility explicitly acknowledged by your *match != '\0' check.
Also true. And I still made a mistake, darn it! Bah, I seem incapable of thinking properly in terms of strstr, so I'll leave it to the rest of you and go sulk in the corner.

>But I guess when you're a perfectionist, it can bug you.