From 15303b2882d9c1fe26587836cb29f41ebbb99017 Mon Sep 17 00:00:00 2001 From: Darshan Sen Date: Tue, 18 May 2021 20:56:53 +0530 Subject: [PATCH] src: fix compiler warnings in node_buffer.cc `offset` and `max_length` can be initialized to `0` to avoid the warnings from `-Wmaybe-uninitialized`. Fixes: https://github.com/nodejs/node/issues/38718 --- src/node_buffer.cc | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/node_buffer.cc b/src/node_buffer.cc index 9006c1de767533..87c82cbdf95fbb 100644 --- a/src/node_buffer.cc +++ b/src/node_buffer.cc @@ -668,8 +668,8 @@ void StringWrite(const FunctionCallbackInfo& args) { Local str = args[0]->ToString(env->context()).ToLocalChecked(); - size_t offset; - size_t max_length; + size_t offset = 0; + size_t max_length = 0; THROW_AND_RETURN_IF_OOB(ParseArrayIndex(env, args[1], 0, &offset)); if (offset > ts_obj_length) {