Uploaded image for project: 'Axis-C++'
  1. Axis-C++
  2. AXISCPP-284

Problem returning a pointer with c_str() to an unnamed string object in SimpleAxisTransport.cpp

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Fixed
    • 1.3 Final
    • 1.4 Alpha
    • None
    • None
    • Windows

    Description

      On Wed, 24 Nov 2004, Steve Hardy wrote:

      > Hey there,
      >
      > I was looking at why axis doesn't want te run on my win32 platform,
      and
      > came across the following (bad) problem:
      >
      > SimpleAxisTransport.cpp, line 244:
      >
      > return m_strSOAPAction.substr(uiOpStart,
      > m_strSOAPAction.length () -
      > uiOpStart).c_str();
      >
      > This is a bad thing because you are returning a pointer with
      c_str()
      to
      > an unnamed string object (the one returned by substr) which is out of
      > context when you return the function. This seems to work in linux,
      (as
      > long as the stack isn't clobbered), but in windows this fails in
      debug
      > mode for sure, and probably in release mode too (MSVC++ 6.0).
      >
      > I'd recommend recoding this to returning a string object or having a
      > c_str() pointer from the m_strSOAPAction object as this doesn't go
      out
      of
      > context.
      >
      > Yours,
      > Steve Hardy

      And the same problem on line 230 with m_strServiceURI

      fixing these two problems (and using Xerces, expat didn't seem to
      work),
      fixes the simpleserver on win32.

      Attachments

        Activity

          People

            samisa Don Samisa Abeysinghe
            samisa Don Samisa Abeysinghe
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: