Unverified Commit d394dd78 authored by Ben Noordhuis's avatar Ben Noordhuis Committed by Anna Henningsen
Browse files

src: fix OOB reads in process.title getter

The getter passed a stack-allocated, fixed-size buffer to
uv_get_process_title() but neglected to check the return value.

When the total length of the command line arguments exceeds the size of
the buffer, libuv returns UV_ENOBUFS and doesn't modify the contents of
the buffer. The getter then proceeded to return whatever garbage was on
the stack at the time of the call, quite possibly reading beyond the
end of the buffer.

Add a GetProcessTitle() helper that reads the process title into a
dynamically allocated buffer that is resized when necessary.

Fixes: https://github.com/nodejs/node/issues/31631

PR-URL: https://github.com/nodejs/node/pull/31633


Reviewed-By: default avatarJames M Snell <jasnell@gmail.com>
Reviewed-By: default avatarAnna Henningsen <anna@addaleax.net>
Reviewed-By: default avatarColin Ihrig <cjihrig@gmail.com>
Reviewed-By: default avatarGus Caplan <me@gus.host>
Reviewed-By: default avatarDavid Carlier <devnexen@gmail.com>
Reviewed-By: default avatarRich Trott <rtrott@gmail.com>
parent 7df42980
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment