Skip to content

[BZ-4210] ACE_String_Base<ACE_CHAR_T>::operator== (const ACE_CHAR_T *s) crash when argument is NULL #4210

@jwillemsen

Description

@jwillemsen
Field Value
Bugzilla ID 4210
Reporter Alexey Zubko
Assigned to DOC Center Support List (internal)
Product ACE
Component ACE Core
Version 6.3.1
Platform / OS All / All
Priority P3
Severity normal
Status NEW
Resolution
Created 2016-02-17 08:53:53 -0600

Originally posted by Alexey Zubko on 2016-02-17 08:53:53 -0600


The operator SIGSEGV if the argument is NULL.

It's necessary to check it before calling ACE_OS::strlen.
The fix would be:

diff -u -N ACE/ace/String_Base.cpp ACE/ace/String_Base.cpp
--- ACE/ace/String_Base.cpp 2014-12-29 05:41:20.000000000 -0500
+++ ACE/ace/String_Base.cpp 1969-12-31 19:01:42.000000784 -0500
@@ -413,7 +413,7 @@
template bool
ACE_String_Base<ACE_CHAR_T>::operator== (const ACE_CHAR_T *s) const
{

  • size_t len = ACE_OS::strlen (s);
  • size_t len = s ? ACE_OS::strlen (s) : 0;
    return this->len_ == len &&
    ACE_OS::memcmp (this->rep_,
    s,

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions