Closed Bug 620411 Opened 9 years ago Closed 5 years ago

nsUserInfo::GetDomain performs a useless null check on an array in nsUserInfoUnix.cpp

Categories

(Toolkit :: Startup and Profile System, enhancement)

x86
Linux
enhancement
Not set

Tracking

()

RESOLVED FIXED
mozilla38

People

(Reporter: timeless, Assigned: timeless)

References

(Blocks 1 open bug)

Details

(Keywords: coverity)

Attachments

(1 file)

878 bytes, patch
benjamin
: review+
benjamin
: approval2.0-
Details | Diff | Splinter Review
134 nsUserInfo::GetDomain(char * *aDomain)
135 {
138     struct utsname buf;
160         if (buf.nodename && buf.nodename[0]) {

http://pubs.opengroup.org/onlinepubs/009695399/basedefs/sys/utsname.h.html
The <sys/utsname.h> header shall define the structure utsname which shall include at least the following members:

char  sysname[]  Name of this implementation of the operating system. 
char  nodename[] Name of this node within the communications 
                 network to which this node is attached, if any. 
char  release[]  Current release level of this implementation. 
char  version[]  Current version level of this release. 
char  machine[]  Name of the hardware type on which the system is running.
Summary: nsUserInfo::GetDomain performs a useless null check on an array → nsUserInfo::GetDomain performs a useless null check on an array in nsUserInfoUnix.cpp
Attached patch patchSplinter Review
Assignee: nobody → timeless
Status: NEW → ASSIGNED
Attachment #498898 - Flags: review?(benjamin)
Attachment #498898 - Flags: approval2.0?
Attachment #498898 - Flags: review?(benjamin)
Attachment #498898 - Flags: review+
Attachment #498898 - Flags: approval2.0?
Attachment #498898 - Flags: approval2.0-
Keywords: checkin-needed
Keywords: checkin-needed
clang now warns on this.
which means that warnings-as-errors builds on clang 3.5 fail.

patch compiles successfully here (at least insofar as passing that file; other bugs stop the build)
Can this be landed? It is hassle to keep applying this patch locally to build and then undo the change before committing changes for other bugs.
timeless said in IRC he can't remember why he removed checkin-needed (after comment 1), and that he's cool with me landing this on his behalf.
Tweaked commit message to describe-the-change (instead of the problem) & landed:
https://hg.mozilla.org/integration/mozilla-inbound/rev/373b1a2edd6a

(Hooray, one fewer local patch I have to apply locally to build w/ newish clang :))
Flags: in-testsuite-
https://hg.mozilla.org/mozilla-central/rev/373b1a2edd6a
Status: ASSIGNED → RESOLVED
Closed: 5 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla38
You need to log in before you can comment on or make changes to this bug.