Skip to content

Commit

Permalink
Expect a space between LinkYSF/LinkFCS and its argument.
Browse files Browse the repository at this point in the history
  • Loading branch information
f1rmb committed Jan 20, 2022
1 parent 15247d0 commit 3af8708
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions YSFGateway/YSFGateway.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -881,8 +881,8 @@ void CYSFGateway::processRemoteCommands()
int res = m_remoteSocket->read(buffer, 200U, addr, addrLen);
if (res > 0) {
buffer[res] = '\0';
if (::memcmp(buffer + 0U, "LinkYSF", 7U) == 0) {
std::string id = std::string((char*)(buffer + 7U));
if ((::memcmp(buffer + 0U, "LinkYSF", 7U) == 0) && (strlen((char*)buffer + 0U) > 8)) {
std::string id = std::string((char*)(buffer + 8U));
// Left trim
id.erase(id.begin(), std::find_if(id.begin(), id.end(), std::not1(std::ptr_fun<int, int>(std::isspace))));
CYSFReflector* reflector = m_reflectors->findById(id);
Expand Down Expand Up @@ -912,8 +912,8 @@ void CYSFGateway::processRemoteCommands()
LogWarning("Invalid YSF reflector id/name - \"%s\"", id.c_str());
return;
}
} else if (::memcmp(buffer + 0U, "LinkFCS", 7U) == 0) {
std::string raw = std::string((char*)(buffer + 7U));
} else if ((::memcmp(buffer + 0U, "LinkFCS", 7U) == 0) && (strlen((char*)buffer + 0U) > 8)) {
std::string raw = std::string((char*)(buffer + 8U));
// Left trim
raw.erase(raw.begin(), std::find_if(raw.begin(), raw.end(), std::not1(std::ptr_fun<int, int>(std::isspace))));
std::string id = "FCS00";
Expand Down

0 comments on commit 3af8708

Please sign in to comment.