Clearing memory securely and reallocations

前端 未结 5 1789
别跟我提以往
别跟我提以往 2020-12-24 07:11

Following the discussion here, if you want to have a secure class for storing sensitive information (e.g passwords) on memory, you have to:

  • memset/clear the me
5条回答
  •  太阳男子
    2020-12-24 07:53

    The string literals will be stored in memory and not managed by the SecByteBlock class.

    This other SO question does a decent job of explaining it: Is a string literal in c++ created in static memory?

    You can try and confirm whether the grep matches can be accounted for by the string literals by seeing how many matches you get. You could also print out the memory locations of the SecByteBlock buffers and try to see if they correspond with the locations in the core dump that match your marker.

提交回复
热议问题