Skip to content

Conversation

@aryansri05
Copy link
Contributor

Description

Fixes OTR whitespace tag false positive detection.

Problem

The current implementation uses strstr() to detect OTR whitespace tags, which matches the pattern anywhere in the message. This causes normal user messages containing these patterns to incorrectly trigger OTR session initialization.

Solution

Changed to use strncmp() to verify that V1/V2 tags immediately follow the base tag, ensuring only legitimate OTR whitespace tags trigger session establishment.

Testing

Built and tested on macOS with libotr 4.1.1.

@jubalh
Copy link
Member

jubalh commented Oct 19, 2025

Is this related to #1957 ? If yes, could you reference the issue in the commit message?

Copy link
Member

@sjaeckel sjaeckel left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

Please update your commit message accordingly to the suggestion of @jubalh and this can be merged.

@aryansri05 aryansri05 force-pushed the fix-otr-whitespace-detection branch from c2345c1 to c8b4b37 Compare November 2, 2025 06:24
@aryansri05
Copy link
Contributor Author

Updated the commit message to reference #1957. Thanks for the review!

The previous implementation used strstr() which would match OTR tag patterns anywhere in the message. This caused normal messages containing these patterns to incorrectly trigger OTR session initialization.

Changed to use strncmp() to verify that V1/V2 tags immediately follow the base tag, ensuring only legitimate OTR whitespace tags trigger session establishment.

Fixes profanity-im#1957
@sjaeckel sjaeckel force-pushed the fix-otr-whitespace-detection branch from c8b4b37 to cff26a9 Compare November 3, 2025 21:05
@sjaeckel
Copy link
Member

sjaeckel commented Nov 3, 2025

I took the liberty to re-format your changes, so it passes CI. I hope that's OK for you :)

@sjaeckel sjaeckel merged commit 5da079b into profanity-im:master Nov 3, 2025
5 checks passed
@aryansri05
Copy link
Contributor Author

No problem at all! Thanks for the help and for merging this. Really appreciate it!

@sjaeckel
Copy link
Member

sjaeckel commented Nov 3, 2025

Thanks for your contribution :)

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

Successfully merging this pull request may close these issues.

3 participants