Closed Bug 735306 Opened 14 years ago Closed 14 years ago

Mistake in certcgi.c source code

Categories

(NSS :: Tools, defect)

x86
Windows XP
defect
Not set
normal

Tracking

(Not tracked)

RESOLVED FIXED

People

(Reporter: guy_vaessen, Assigned: guy_vaessen)

Details

Attachments

(1 file)

User Agent: Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 5.1; Trident/4.0; .NET CLR 2.0.50727; .NET CLR 3.0.04506.648; .NET CLR 3.5.21022; .NET CLR 1.1.4322; .NET CLR 3.0.4506.2152; .NET CLR 3.5.30729; MS-RTC LM 8; .NET4.0C) Steps to reproduce: Ran cppcheck V1.52: it found a bug in certcgi.c More specific: security\nss\cmd\certcgi\certcgi.c at row :1432 The code in question is: if (value >= 0 || value < 256) { This is alway's true! That can't be a usefull check! The reported error by cppcheck is: (warning) Mutual exclusion over || always evaluates to true. Did you intend to use && instead? Actual results: Verified the reported error of cppcheck. In this case cppcheck is right, && should have been used. Expected results: Replace || with && on: security\nss\cmd\certcgi\certcgi.c at row :1432 --if (value >= 0 || value < 256) { ++if (value >= 0 && value < 256) { OR remove this entire check. (The check is useless, so it needs to be modified or removed.)
Assignee: nobody → nobody
Component: Security → Tools
Product: Core → NSS
QA Contact: toolkit → tools
Version: Trunk → trunk
Guy do you feel like making a patch ?
patch for bug 735306 /r
Assignee: nobody → guy_vaessen
Status: UNCONFIRMED → ASSIGNED
Ever confirmed: true
Attachment #605514 - Flags: review?(bsmith)
Attachment #605514 - Flags: review?(bsmith) → review+
Can this be flagged chedkin needed ?
Keywords: checkin-needed
Guy, thank you for your contribution (although this code might no longer be in use). Checking in certcgi/certcgi.c; /cvsroot/mozilla/security/nss/cmd/certcgi/certcgi.c,v <-- certcgi.c new revision: 1.22; previous revision: 1.21 done
Status: ASSIGNED → RESOLVED
Closed: 14 years ago
Resolution: --- → FIXED
Keywords: checkin-needed
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: