Possibility of negative value for timeout variable of the pselect inside mosquitto_loop #329

Closed
Dollars opened this Issue Dec 5, 2016 · 1 comment

Comments

Projects
None yet
2 participants
@Dollars

Dollars commented Dec 5, 2016

If you make a sleep in a loop before calling mosquitto_loop it is possible that now is greater than mosq->next_msg_out which result in a negative value for timeout. Then, pselect will fail with a EINVAL error. Should'nt we add timeout = timeout < 0 ? 0 : timeout inside the if block ?

ralight added a commit that referenced this issue Dec 8, 2016

@ralight ralight added this to the fixes-next milestone Dec 8, 2016

@ralight

This comment has been minimized.

Show comment
Hide comment
@ralight

ralight Dec 8, 2016

Contributor

Thanks, you're quite right. I've fixed this on the fixes branch.

Contributor

ralight commented Dec 8, 2016

Thanks, you're quite right. I've fixed this on the fixes branch.

@ralight ralight closed this Dec 8, 2016

ralight added a commit that referenced this issue Feb 20, 2017

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