Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 94d02ca

Browse filesBrowse files
sam-githubMylesBorins
authored andcommitted
src: fix warning for potential snprintf truncation
gcc 8+ recognizes that space has not been left for the pid and that the return value of snprintf() isn't checked. Leave a little space for the pid to prevent `-Wformat-truncation`. PR-URL: #24810 Reviewed-By: Richard Lau <riclau@uk.ibm.com>
1 parent c3dda00 commit 94d02ca
Copy full SHA for 94d02ca

File tree

Expand file treeCollapse file tree

1 file changed

+2
-1
lines changed
Open diff view settings
Filter options
Expand file treeCollapse file tree

1 file changed

+2
-1
lines changed
Open diff view settings
Collapse file

‎src/util.cc‎

Copy file name to clipboardExpand all lines: src/util.cc
+2-1Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -116,7 +116,8 @@ std::string GetHumanReadableProcessName() {
116116
}
117117

118118
void GetHumanReadableProcessName(char (*name)[1024]) {
119-
char title[1024] = "Node.js";
119+
// Leave room after title for pid, which can be up to 20 digits for 64 bit.
120+
char title[1000] = "Node.js";
120121
uv_get_process_title(title, sizeof(title));
121122
snprintf(*name, sizeof(*name), "%s[%d]", title, uv_os_getpid());
122123
}

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.