I have
typedef unsigned int DWORD;
void write_str(string str, char** buf) {
DWORD len = str.size();
**buf = len;
*buf += sizeof(len);
memcpy(*buf, str.c_str(), len);
*buf += len;
}
This code, and only 1 byte is overwriten in **buf = len; if i have i.e. 7 in len while 4 should be, since sizeof(DWORD) = 4
As
bufis achar **,**bufis achar. It can hold only a single byte. Therefore, only a single byte is written to it.