This problem is caused by memory overrun
const char* fmt = "rdma-ping-%08d: ";
char* base_buffer = new char[buffer_size];
memset(base_buffer, '\0', buffer_size);
/* Put some ascii text in the buffer. */
int start = 65;
//Here the assignment exceeds the size of the array, will be in the indeterminate time error!
int buff_size = buffer_size + 1;
int offset = (int)strlen(fmt);
int c = (unsigned char)start;
for (int i = offset; i < buff_size; i++)
{
base_buffer[i] = (CHAR)c;
if (++c > 122)
c = 65;
}
if (++start > 122)
start = 65;
Similar Posts:
- C++ Error: Run-Time Check Failure #2 – Stack around the variable ‘cc’ was corrupted.
- MYSQL Error: Out of sort memory, consider increasing server sort buffer size; nested exception is java.sql.SQLException: Out of sort memory, consider increasing server sort buffer size
- How to Solve Mysql Error 1206: The total number of locks exceeds the lock table size
- How to deal with the prompt “dereferencing type punned pointer will break strict aliasing rules” when compiling C?
- Tomcat Error: Invalid maximum heap size
- How to Solve Const variable assignment Error
- C++ Project Error: C Undefined symbols for architecture x86_64: “char_width(char)”
- assignment makes pointer from integer without a…
- Nginx an upstream response is buffered to a temporary file,nginx502 Error
- [Solved] Oracle Import Error:field in data file exceeds maximum length