Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix several buffer overflows in TRXManager #7

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
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
12 changes: 4 additions & 8 deletions TRXManager/TRXManager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -320,9 +320,8 @@ int ::ARFCNManager::sendCommand(const char*command, const char*param, int *respo
int rspLen = sendCommandPacket(cmdBuf,response);
if (rspLen<=0) return -1;
// Parse and check status.
char cmdNameTest[15];
char cmdNameTest[16] = { 0 };
int status;
cmdNameTest[0]='\0';
if (!responseParam)
sscanf(response,"RSP %15s %d", cmdNameTest, &status);
else
Expand All @@ -340,9 +339,8 @@ int ::ARFCNManager::sendCommand(const char*command, int param, int *responsePara
int rspLen = sendCommandPacket(cmdBuf,response);
if (rspLen<=0) return -1;
// Parse and check status.
char cmdNameTest[15];
char cmdNameTest[16] = { 0 };
int status;
cmdNameTest[0]='\0';
if (!responseParam)
sscanf(response,"RSP %15s %d", cmdNameTest, &status);
else
Expand All @@ -361,9 +359,8 @@ int ::ARFCNManager::sendCommand(const char*command, const char* param)
int rspLen = sendCommandPacket(cmdBuf,response);
if (rspLen<=0) return -1;
// Parse and check status.
char cmdNameTest[15];
char cmdNameTest[16] = { 0 };
int status;
cmdNameTest[0]='\0';
sscanf(response,"RSP %15s %d", cmdNameTest, &status);
if (strcmp(cmdNameTest,command)!=0) return -1;
return status;
Expand All @@ -380,9 +377,8 @@ int ::ARFCNManager::sendCommand(const char*command)
int rspLen = sendCommandPacket(cmdBuf,response);
if (rspLen<=0) return -1;
// Parse and check status.
char cmdNameTest[15];
char cmdNameTest[16] = { 0 };
int status;
cmdNameTest[0]='\0';
sscanf(response,"RSP %15s %d", cmdNameTest, &status);
if (strcmp(cmdNameTest,command)!=0) return -1;
return status;
Expand Down