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

inspector: Fix Coverty scan errors #7324

Closed
wants to merge 1 commit into from
Closed

inspector: Fix Coverty scan errors #7324

wants to merge 1 commit into from

Conversation

eugeneo
Copy link
Contributor

@eugeneo eugeneo commented Jun 16, 2016

Checklist
  • make -j4 test (UNIX) or vcbuild test nosign (Windows) passes
  • the commit message follows commit guidelines
Affected core subsystem(s)

This touches inspector

Description of change

Fix a bug detected by Coverty.

CC: @ofrobots

@nodejs-github-bot nodejs-github-bot added the c++ Issues and PRs that require attention from people who are familiar with C++. label Jun 16, 2016
@cjihrig
Copy link
Contributor

cjihrig commented Jun 16, 2016

@mscdex mscdex added the inspector Issues and PRs related to the V8 inspector protocol label Jun 16, 2016
@ofrobots
Copy link
Contributor

LGTM. The CI is green.

@bnoordhuis
Copy link
Member

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 uv_get_process_title() fails. It can't really happen under normal circumstances but better safe than sorry.

@eugeneo
Copy link
Contributor Author

eugeneo commented Jun 16, 2016

@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");
Copy link
Member

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.)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done. Thanks!

@bnoordhuis
Copy link
Member

LGTM with a comment.

@ofrobots
Copy link
Contributor

ofrobots pushed a commit that referenced this pull request Jun 17, 2016
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]>
@ofrobots
Copy link
Contributor

Landed as dfcf02b.

@ofrobots ofrobots closed this Jun 17, 2016
Fishrock123 pushed a commit that referenced this pull request Jul 5, 2016
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]>
@Fishrock123 Fishrock123 mentioned this pull request Jul 5, 2016
@eugeneo eugeneo deleted the coverty branch August 2, 2016 23:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
c++ Issues and PRs that require attention from people who are familiar with C++. inspector Issues and PRs related to the V8 inspector protocol
Projects
None yet
Development

Successfully merging this pull request may close these issues.

8 participants