-
Notifications
You must be signed in to change notification settings - Fork 30.4k
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
inspector: Fix Coverty scan errors #7324
Conversation
LGTM. The CI is green. |
LGTM The ASSERT_EQ a few lines up should probably be a CHECK_EQ. The buffer is filled with whatever is on the stack if |
@bnoordhuis I'm now setting target title to a default value if the call fails. |
@@ -110,9 +110,11 @@ void SendTargentsListResponse(inspector_socket_t* socket, int port) { | |||
char buffer[sizeof(LIST_RESPONSE_TEMPLATE) + 4096]; | |||
char title[2048]; // uv_get_process_title trims the title if too long | |||
int err = uv_get_process_title(title, sizeof(title)); | |||
ASSERT_EQ(0, err); | |||
if (err != 0) { | |||
strcpy(title, "Node.js"); |
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.
Can you use snprintf()
? Most static analysis tools will complain about strcpy()
(even if it's harmless here.)
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.
Done. Thanks!
LGTM with a comment. |
New CI https://ci.nodejs.org/job/node-test-pull-request/3015/ is green. |
PR-URL: #7324 Reviewed-By: cjihrig - Colin Ihrig <[email protected]> Reviewed-By: ofrobots - Ali Ijaz Sheikh <[email protected]> Reviewed-By: bnoordhuis - Ben Noordhuis <[email protected]>
Landed as dfcf02b. |
PR-URL: #7324 Reviewed-By: cjihrig - Colin Ihrig <[email protected]> Reviewed-By: ofrobots - Ali Ijaz Sheikh <[email protected]> Reviewed-By: bnoordhuis - Ben Noordhuis <[email protected]>
Checklist
make -j4 test
(UNIX) orvcbuild test nosign
(Windows) passesAffected core subsystem(s)
This touches inspector
Description of change
Fix a bug detected by Coverty.
CC: @ofrobots