#1232 string compare \x00 \x20 incorrectly returns 1

obsolete: 8.2
closed-fixed
5
2001-04-06
2000-10-26
Anonymous
No

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

Discussion

  • Don Porter

    Don Porter - 2001-04-05
    • labels: 104244 --> 18. Commands M-Z
     
  • Donal K. Fellows

    • assigned_to: nobody --> dkf
     
  • Donal K. Fellows

    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.)

     
  • Donal K. Fellows

    • status: open --> closed-fixed
     

Get latest updates about Open Source Projects, Conferences and News.

Sign up for the SourceForge newsletter:

JavaScript is required for this form.





No, thanks