Memory Clobbering Error
You are incrementing ptr, therefore changing the address that it points to. You can’t do that. In your case, have a separate pointer, let’s say char * p = ptr and do your operations with p leaving ptr intact so you can free(ptr) later. EDIT Taking a second look at your code, I found that … Read more