Project

General

Profile

Actions

Bug #4848

open

libnsl: The initial check in nb_send() is complete mess

Added by Marcel Telka over 8 years ago. Updated over 8 years ago.

Status:
In Progress
Priority:
Low
Assignee:
Category:
lib - userland libraries
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:

  1. The original author probably wanted to write "2 << 31" (shift) instead of "2^31" (xor),
  2. according the operator precedences, "ntohl(...) & 2" is evaluated first. The "^31" is evaluated after "&",
  3. based on the above, the condition at line 1658 is always FALSE,
  4. 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 #1

Updated by Marcel Telka over 8 years ago

  • Priority changed from Normal to Low
Actions

Also available in: Atom PDF