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

Fix topic name parsing #280

Closed
facucc opened this issue Apr 12, 2024 · 2 comments
Closed

Fix topic name parsing #280

facucc opened this issue Apr 12, 2024 · 2 comments

Comments

@facucc
Copy link

facucc commented Apr 12, 2024

The value of the topic name variable is taking the value of the topic name + payload
The error is in the line 1448

Example:

  • TopicName --> $aws/things/test/jobs/start-next/accepted{"clientToken":"test","timestamp":1712955349}

Must be

  • TopicName --> $aws/things/test/jobs/start-next/accepted
@AniruddhaKanhere
Copy link
Member

Hello @facucc,

Thank you for reaching out to us.

The topic name pointer (pPublishInfo->pTopicName) returned by the code is NOT NULL terminated. Your application must use the topic name length (pPublishInfo->topicNameLength) to determine where does the topic end.

This is done to reuse the existing payload memory instead having to copy it to a different string in order to NULL terminate it.

Does that answer your question? Or are you saying that the topic name length variable is set incorrectly so that you are reading into the payload?

Thanks,
Aniruddha

@AniruddhaKanhere
Copy link
Member

Hello @facucc,

I take it by your 'thumbs up' reaction that this fixed the issue you were having. Thus, I'll be closing this ticket.

Please feel free to reopen this thread if I misunderstood you and the issue persists.

Thanks,
Aniruddha

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