Changeset 1dafe18 in mainline


Ignore:
Timestamp:
2023-10-22T13:56:55Z (14 months ago)
Author:
Jiří Zárevúcky <zarevucky.jiri@…>
Branches:
master, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
b32cff2a
Parents:
765995a
git-author:
Vojtech Horky <vojtech.horky@…> (2023-07-14 14:24:56)
git-committer:
Jiří Zárevúcky <zarevucky.jiri@…> (2023-10-22 13:56:55)
Message:

C++ lib: prevent use after free (hackish)

File:
1 edited

Legend:

Unmodified
Added
Removed
  • uspace/lib/cpp/src/future.cpp

    r765995a r1dafe18  
    8484    const char* future_error::what() const noexcept
    8585    {
    86         return code().message().c_str();
     86        /*
     87         * FIXME
     88         * Following code would be optimal but the message string is
     89         * actually destroyed before the function returns so we would
     90         * be returning a dangling pointer. No simple fix available, hence
     91         * we use the ugly hack.
     92         */
     93        //return code().message().c_str();
     94#define QUOTE_ARG(arg) #arg
     95        return "future_error, see " __FILE__ ":" QUOTE_ARG(__LINE__);
    8796    }
    8897}
Note: See TracChangeset for help on using the changeset viewer.