test: fix out-of-bound reads from invalid sizeof usage
`sizeof(data)` does not return the correct result here, as it measures the size of the `data` variable, not what it points to. PR-URL: https://github.com/nodejs/node/pull/33115 Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com>
This commit is contained in:
parent
ff38ec0471
commit
8698dd98bb
@ -30,7 +30,7 @@ void Initialize(Local<Object> exports,
|
||||
node::Buffer::New(
|
||||
isolate,
|
||||
data,
|
||||
sizeof(data),
|
||||
sizeof(char),
|
||||
[](char* data, void* hint) {
|
||||
delete data;
|
||||
free_call_count++;
|
||||
|
@ -35,7 +35,7 @@ NAPI_MODULE_INIT() {
|
||||
NAPI_CALL(env, napi_create_external_arraybuffer(
|
||||
env,
|
||||
data,
|
||||
sizeof(data),
|
||||
sizeof(char),
|
||||
finalize_cb,
|
||||
NULL,
|
||||
&buffer));
|
||||
|
Loading…
x
Reference in New Issue
Block a user