-
Notifications
You must be signed in to change notification settings - Fork 0
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
Hardening/3109 remove payload word part 2 #35
Changes from 8 commits
e725e77
bea67d4
7436d12
469d1cc
6097429
12c2e64
99c0356
2dc1cee
4dfd0c0
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -162,7 +162,7 @@ bool getIPv6Port(const std::string& in, std::string& outIp, std::string& outPort | |
* | ||
* stringSplit - | ||
*/ | ||
int stringSplit(const std::string& in, char delimiter, std::vector<std::string>& outV) | ||
int stringSplit(const std::string& in, char delimiter, std::vector<std::string>& outV, bool skipLastComponentIfEmpty) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. New parameter (skipLastComponentIfEmpty) is a bit obscure... An explantation (or example) in the function preamble would be great. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I thought the name was descriptive enough ... There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Fixed in 4dfd0c0 |
||
{ | ||
char* s = strdup(in.c_str()); | ||
char* toFree = s; | ||
|
@@ -197,10 +197,19 @@ int stringSplit(const std::string& in, char delimiter, std::vector<std::string>& | |
++s; | ||
} | ||
|
||
|
||
// 4. pick up all components | ||
for (int ix = 0; ix < components; ix++) | ||
{ | ||
// is last component empty? | ||
if (skipLastComponentIfEmpty == true) | ||
{ | ||
if ((ix == components - 1) && (*start == 0)) | ||
{ | ||
components -= 1; | ||
break; | ||
} | ||
} | ||
|
||
outV.push_back(start); | ||
start = &start[strlen(start) + 1]; | ||
} | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -198,14 +198,13 @@ std::string jsonTreat | |
|
||
if (reqP == NULL) | ||
{ | ||
std::string details = std::string("Sorry, no request treating object found for RequestType /") + requestType(request) + "/"; | ||
std::string errorReply; | ||
char reqTypeV[STRING_SIZE_FOR_INT]; | ||
|
||
restErrorReplyGet(ciP, SccBadRequest, details, &errorReply); | ||
restErrorReplyGet(ciP, SccBadRequest, "service not found", &errorReply); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Maybe "service not found" should be a #define? I remember we have a .h with the "magic strings" used in error messages. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Fixed in 4dfd0c0 |
||
snprintf(reqTypeV, sizeof(reqTypeV), "%d", request); | ||
|
||
details = std::string("no request treating object found for RequestType ") + reqTypeV + " (" + requestType(request) + ")"; | ||
std::string details = std::string("no request treating object found for RequestType ") + reqTypeV + " (" + requestType(request) + ")"; | ||
alarmMgr.badInput(clientIp, details); | ||
|
||
return errorReply; | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Does the refactor and changes done in this PR has any impact in Developers Manual?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No, we didn't get down to this level of details in the manual, fortunately ...