How to fix Out-of-bounds access (OVERRUN) error

338 views Asked by At

I ran the coverity analysis tool on my c++ code and it is showing me "overrun-buffer-arg" warning when calling copy().

What is overrun buffer and how can I solve it?

Here's my code snippet-

    if ( itr == m_unloadAppFunctions->end())
    {
        CallbackFunc *cFunc = new CallbackFunc();
        std::string *tmpS = new std::string;
        tmpS->copy( const_cast <char*> ( callbackType->c_str()), std::string::npos);
        cFunc->callbackType = tmpS;
        cFunc->functionPtr = functionPtr;
        m_unloadAppFunctions->insert(appFunctions::value_type(callbackFunctionTag, cFunc));
    }

Screenshot from coverity tool-

Coverity issue:-

0

There are 0 answers