Skip to content
This repository was archived by the owner on Sep 7, 2022. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion GDBManipulator/src/Utils.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -211,8 +211,12 @@ void utils::sharedMemoryInit() {
}

void utils::sharedMemoryWrite(char *buff, int size) {
if(size >128){
Log:log("write more than 128 byte to shared mem --> fail op",CriticError)
return;
}
#ifdef __linux__
memcpy_s(shmem,128, buff, size);
memcpy(shmem, buff, size);
#elif __WIN32
HANDLE hMapFile;
LPCTSTR pBuf;
Expand Down
10 changes: 5 additions & 5 deletions GDBManipulator/src/comChain/decoder/GdbInterface.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ char * coppyString(const char * toCoppy)
return 0;
}
memset(out,0,size);
memcpy_s(out,size,toCoppy,size);
memcpy(out,toCoppy,size);
return out;
}

Expand Down Expand Up @@ -118,7 +118,7 @@ static void handleGDB(string command, nameLessPipe *nlp, string elfLoc, int port
char mi2[] = "--interpreter=mi2";
char qiet[] = "-q";
char port_v[20];
sprintf_s(port_v,20, "%d", port);
sprintf(port_v, "%d", port);

char elf_[elfLoc.length() + 1] = {0,};

Expand Down Expand Up @@ -215,7 +215,7 @@ static void handleServer(nameLessPipe *nlp) {
notJetFailed = false;
} else if (l.find("Shutting down...") != string::npos) {
char buff[50] = {0,};
sprintf_s(buff, "%s",50, utils::sharedMemoryRead());
sprintf(buff, "%s", utils::sharedMemoryRead());
buff[4] = 0; // set end string if match
if(strcmp(buff,"true") != 0){
Log::log("GDB-Server has been shutting down unexpected", Error, logFilter::GDB_Server);
Expand Down Expand Up @@ -250,14 +250,14 @@ static void callGdbServer(string command, nameLessPipe *nlp) {
index = 0;
string location = command.substr(0, index);
Log::log("GDB-Server : set location of child process to " + location, Info, logFilter::GDB_Server);
if(location == nullpntr || chdir(location.c_str())<0){
if(location == "" || chdir(location.c_str())<0){
return ;
}
if(execv(argv[0], argv) == -1) {
Log::log("GDB-Server exit with errno: \t\"" + string(strerror(errno))+ "\" ", CriticError, logFilter::GDB_Server);
}
char buff[50] = {0,};
sprintf_s(buff, "%s",,50, utils::sharedMemoryRead());
sprintf(buff, "%s", utils::sharedMemoryRead());
buff[4] = 0; // set end string if match
if(strcmp(buff,"true") != 0){
//cout << buff<<endl;
Expand Down