src: remove redundant buffer size check

This condition is already checked by the CHECK_BUFLEN_IN_RANGE macro,
so if it was true here, that would contradict the previous check.

PR-URL: https://github.com/nodejs/node/pull/42257
Reviewed-By: Rich Trott <rtrott@gmail.com>
Reviewed-By: Mestery <mestery@protonmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
This commit is contained in:
Tobias Nießen authored and Danielle Adams committed 2022-04-23 22:47:16 -04:00
1 parent ba1d949ce0
commit 268fd97925
1 file changed
-4
-4
View File
@@ -642,10 +642,6 @@ MaybeLocal<Value> StringBytes::Encode(Isolate* isolate,
switch (encoding) {
case BUFFER:
{
if (buflen > node::Buffer::kMaxLength) {
*error = node::ERR_BUFFER_TOO_LARGE(isolate);
return MaybeLocal<Value>();
}
auto maybe_buf = Buffer::Copy(isolate, buf, buflen);
Local<v8::Object> buf;
if (!maybe_buf.ToLocal(&buf)) {