PR_StringToNetAddr("", *ptr) behaviour is inconsistent on windows & solaris

RESOLVED FIXED in 4.8.4

Status

NSPR
NSPR
P2
normal
RESOLVED FIXED
16 years ago
8 years ago

People

(Reporter: Gopinath.M.R., Assigned: Wan-Teh Chang)

Tracking

4.8.4
x86
Windows 2000

Firefox Tracking Flags

(Not tracked)

Details

Attachments

(1 attachment)

(Reporter)

Description

16 years ago
Hi,
  When the hostname is given as empty string, the inet_address(..) method on
solaris returns -1 and on windows it returns 0 (NULL).  But the implementation
checks for only value -1 and returns PR_FAILURE.
 So on windows I get PR_SUCCESS and on solaris I get PR_FAILURE.
Additional check for return value is NULL has to be added for windows and should
return PR_FAILURE.
  NOTE: The value "0.0.0.0" returns zero on windows, so the only way to check
the error is 
#ifdef WINDOWS
  if (retValue == 0) {
    check whether string is empty or contains only space
    if yes,
          return PR_FAILURE
    else 
         // value was 0.0.0.0
   }
#endifI looked at NSPR implementation in file pr/src/misc/prnetdb.c
(Assignee)

Updated

16 years ago
Status: UNCONFIRMED → ASSIGNED
Ever confirmed: true
(Assignee)

Comment 1

16 years ago
I found that inet_addr() behaves the same on Solaris and
Windows when the host name string begins with white space.
It returns 0 on both platforms.

The behavior is only different when the host name is an
empty string.  On Solaris inet_addr() returns -1 while on
Windows it returns 0.

I can test for an empty string on Windows and return
PR_FAILURE to make the behavior of PR_StringToNetAddr
consistent on Solaris and Windows, but it is strange
to return 0 on host names that begin with white space,
for example, " 10.169.2.10".
Priority: -- → P2
Target Milestone: --- → 4.3
(Assignee)

Comment 2

16 years ago
Created attachment 94278 [details] [diff] [review]
Proposed patch

This patch will make the PR_StringToNetAddr("", addr) behaviour
consistent on windows and solaris.
Depends on: 344809
QA Contact: wtchang → nspr

Comment 3

11 years ago
The target milestone is already released. Resetting target milestone.
Target Milestone: 4.3 → ---

Comment 4

8 years ago
Fixed per bug 344809.
Status: ASSIGNED → RESOLVED
Last Resolved: 8 years ago
Resolution: --- → FIXED
(Assignee)

Updated

8 years ago
Target Milestone: --- → 4.8.4
You need to log in before you can comment on or make changes to this bug.