Actions
Bug #4848
openlibnsl: The initial check in nb_send() is complete mess
Start date:
2014-05-05
Due date:
% Done:
0%
Estimated time:
Difficulty:
Bite-size
Tags:
needs-triage
Gerrit CR:
External Bug:
Description
There is following piece of code in nb_send():
1658 if (!(ntohl(*(uint32_t *)buff) & 2^31)) { 1659 return (-1); 1660 }
These lines should be removed for various reasons:
- The original author probably wanted to write "2 << 31" (shift) instead of "2^31" (xor),
- according the operator precedences, "ntohl(...) & 2" is evaluated first. The "^31" is evaluated after "&",
- based on the above, the condition at line 1658 is always FALSE,
- there is no need for such check, because the beginning of the buff data have no special meaning. This seems to be an artifact from deep (and already forgotten) history.
Actions