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

Assert fails on empty string #251

Closed
dimmykar opened this issue May 24, 2023 · 1 comment · Fixed by #252
Closed

Assert fails on empty string #251

dimmykar opened this issue May 24, 2023 · 1 comment · Fixed by #252

Comments

@dimmykar
Copy link

I'm trying to port my code from v1.2.0 to v2.1.0, which is integrated into the coreMQTT-Agent. However, I have come across an unexpected assertion firing which was not present in previous v1.2.0. Upon analyzing the code, I discovered that the problem also exists in v2.1.1 too.

assert( ( length != 0U ) == ( string != NULL ) );

In my code I am trying to connect to a test broker that does not require a login and password. That's why I pass empty strings as "" and not NULL. strlen of the empty string returns 0, so this assertion fires: I have a valid string that is not NULL, but its length is 0.

Workaround of this problem can be achieved by passing a pointer to NULL instead of the empty string "". But still I think this case should not be handled as fatal error.

@archigup
Copy link
Member

Thanks for the bug report! I'll open a PR to fix this shortly.

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 a pull request may close this issue.

2 participants