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

Calling close on possible negative integer #1563

Closed
athos-ribeiro opened this issue Aug 5, 2019 · 1 comment · Fixed by #1585
Closed

Calling close on possible negative integer #1563

athos-ribeiro opened this issue Aug 5, 2019 · 1 comment · Fixed by #1585
Assignees
Labels

Comments

@athos-ribeiro
Copy link
Contributor

In https://github.com/giampaolo/psutil/blob/master/psutil/_psutil_posix.c#L390 (and also in line 428), there is a call to close on sock. The issue here is that sock could be set to -1 before this call and then close would set EBADF error.

I am opening this issue to check if this is an actual problem. On a confirmation, i could submit a patch for this.

Thanks.

@giampaolo
Copy link
Owner

Yep please do. It looks like the variable should be initialized to -1 (since socket() on error returns -1).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants