Skip to content
This repository was archived by the owner on Sep 7, 2022. It is now read-only.

Commit 0fabb50

Browse files
authored
Merge pull request #4 from diridari/dev
fix compile error on linux
2 parents 8f19df4 + 7828889 commit 0fabb50

File tree

2 files changed

+10
-6
lines changed

2 files changed

+10
-6
lines changed

GDBManipulator/src/Utils.cpp

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -211,8 +211,12 @@ void utils::sharedMemoryInit() {
211211
}
212212

213213
void utils::sharedMemoryWrite(char *buff, int size) {
214+
if(size >128){
215+
Log:log("write more than 128 byte to shared mem --> fail op",CriticError)
216+
return;
217+
}
214218
#ifdef __linux__
215-
memcpy_s(shmem,128, buff, size);
219+
memcpy(shmem, buff, size);
216220
#elif __WIN32
217221
HANDLE hMapFile;
218222
LPCTSTR pBuf;

GDBManipulator/src/comChain/decoder/GdbInterface.cpp

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ char * coppyString(const char * toCoppy)
2929
return 0;
3030
}
3131
memset(out,0,size);
32-
memcpy_s(out,size,toCoppy,size);
32+
memcpy(out,toCoppy,size);
3333
return out;
3434
}
3535

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

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

@@ -215,7 +215,7 @@ static void handleServer(nameLessPipe *nlp) {
215215
notJetFailed = false;
216216
} else if (l.find("Shutting down...") != string::npos) {
217217
char buff[50] = {0,};
218-
sprintf_s(buff, "%s",50, utils::sharedMemoryRead());
218+
sprintf(buff, "%s", utils::sharedMemoryRead());
219219
buff[4] = 0; // set end string if match
220220
if(strcmp(buff,"true") != 0){
221221
Log::log("GDB-Server has been shutting down unexpected", Error, logFilter::GDB_Server);
@@ -250,14 +250,14 @@ static void callGdbServer(string command, nameLessPipe *nlp) {
250250
index = 0;
251251
string location = command.substr(0, index);
252252
Log::log("GDB-Server : set location of child process to " + location, Info, logFilter::GDB_Server);
253-
if(location == nullpntr || chdir(location.c_str())<0){
253+
if(location == "" || chdir(location.c_str())<0){
254254
return ;
255255
}
256256
if(execv(argv[0], argv) == -1) {
257257
Log::log("GDB-Server exit with errno: \t\"" + string(strerror(errno))+ "\" ", CriticError, logFilter::GDB_Server);
258258
}
259259
char buff[50] = {0,};
260-
sprintf_s(buff, "%s",,50, utils::sharedMemoryRead());
260+
sprintf(buff, "%s", utils::sharedMemoryRead());
261261
buff[4] = 0; // set end string if match
262262
if(strcmp(buff,"true") != 0){
263263
//cout << buff<<endl;

0 commit comments

Comments
 (0)