Skip to content

Conversation

@woodpeck
Copy link
Contributor

It is not guaranteed that recv will always return the number of bytes you have asked for; it can return fewer bytes which should not be treated as an error. This is a rare issue but I have actually encountered it on a (virtualised) system. Review requested though - unsure if I have the logic watertight.

if (s > 0) {
bzero(&resp, sizeof(struct protocol));
ret = recv(fd, &resp, sizeof(struct protocol_v2), 0);
ret = recv(fd, &resp + already_read, want - already_read, 0);

Check notice

Code scanning / Flawfinder

Function accepts input from outside program (CWE-20).

input/recv:Function accepts input from outside program (CWE-20).
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.

1 participant