Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/nodejs/node.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorMichael Dawson <mdawson@devrus.com>2022-04-09 00:17:51 +0300
committerMichael Dawson <mdawson@devrus.com>2022-04-13 22:07:31 +0300
commit3026ca0bf2d659f07a6f65a375f707acf63d0eb1 (patch)
treeeafc0789bb9f1ff36a00d51909311df15bd57204 /src
parent6669b3857f0f43ee0296eb7ac45086cd907b9e94 (diff)
src: fix coverity report
Fix coverity report about possibly dereferencing a null. If the the buffer.data != nullptr check indicates that the buffer was null, then relying on the value in buffer_size is no longer safe. The later call to uv_pipe_getpeername depends on the buffer_size being correct to avoid deferencing buffer.data if it is not big enough. Signed-off-by: Michael Dawson <mdawson@devrus.com> PR-URL: https://github.com/nodejs/node/pull/42663 Reviewed-By: Darshan Sen <raisinten@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com>
Diffstat (limited to 'src')
-rw-r--r--src/node_report_utils.cc2
1 files changed, 2 insertions, 0 deletions
diff --git a/src/node_report_utils.cc b/src/node_report_utils.cc
index 82ed385ad17..6d8b211b6d1 100644
--- a/src/node_report_utils.cc
+++ b/src/node_report_utils.cc
@@ -95,6 +95,8 @@ static void ReportPipeEndpoints(uv_handle_t* h, JSONWriter* writer) {
buffer = MallocedBuffer<char>(buffer_size);
if (buffer.data != nullptr) {
rc = uv_pipe_getsockname(&handle->pipe, buffer.data, &buffer_size);
+ } else {
+ buffer_size = 0;
}
}
if (rc == 0 && buffer_size != 0 && buffer.data != nullptr) {