Skip to content
Tcl Source Code View Ticket
Login

View Ticket

string compare \x00 \x20 incorrectly returns 1

Closed / Fixed219201ffffffffffffffffffffffffffffffffffCreated 26 years agoUpdated 26 years ago
Descriptionplain2000-10-26 05:03:29
OriginalBugID: 3103 Bug
Version: 8.2
SubmitDate: '1999-10-15'
LastModified: '1999-10-15'
Severity: SER
Status: Assigned
Submitter: hobbs
ChangedBy: hobbs
OS: All
FixedDate: '2000-10-25'
ClosedDate: '2000-10-25'


Exists since 8.1a1.  The problem is the memcmp case, which doesn't
take into account that the NULL byte is 2 \x80's.

There is a work-around:
    string compare -length 1 \x00 \x20
dgp Ticket [219201ffff]: 1 change [History diff]2001-04-06 03:16:24
dkf Ticket [219201ffff]: 1 change [History diff]2001-04-06 15:53:31
dkfplain2001-04-06 16:08:50
Logged In: YES 
user_id=79902

Correct fix is to not use memcmp() unless you are comparing
two *Unicode* strings (you'd be OK as well if you were using
ASCII, but determining that is expensive in itself.)
dkf Closed ticket [219201ffff]. [History diff]2001-04-06 17:50:24
Log in (anonymous is fine) to add a comment.