diff options
author | Matthew Taylor <mstaveleytaylor@gmail.com> | 2017-07-01 04:56:11 +0100 |
---|---|---|
committer | cjihrig <cjihrig@gmail.com> | 2017-07-12 09:45:14 -0400 |
commit | 78c17238f48d9083359206a2215fc63dd7a0283d (patch) | |
tree | e60565db379a51c4884831b9c7c64128f1eba5cb /docs/src | |
parent | bdc87005a17ce843e0efca8938aa8c190aa91a38 (diff) | |
download | libuv-78c17238f48d9083359206a2215fc63dd7a0283d.tar.gz libuv-78c17238f48d9083359206a2215fc63dd7a0283d.zip |
unix: always copy process title into local buffer
Ensures that the user's argv is copied into a local buffer when calling
uv_setup_args. Before, the argv was simply being pointed to, which
meant that libuv could end up accessing invalid memory if the user
decided to later edit the memory at that location. It also meant that a
subsequent call to uv_set_process_title would never write more
characters than the length of argv[0].
With the new changes, argv[0] is copied into a temporary buffer and any
subsequent calls to uv_set_process_title will thus be able to copy as
many characters as the call to uv__strdup permits. Note that on *BSD
and AIX this behaviour was already in effect .
Some error checking (specifically checking the result of uv__strdup)
has been added, and calls to uv__free rearranged so that in case of
ENOMEM uv__free can't be called erroneously.
Fixes: https://github.com/libuv/libuv/issues/1395
PR-URL: https://github.com/libuv/libuv/pull/1396
Reviewed-By: Saúl Ibarra Corretgé <saghul@gmail.com>
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Diffstat (limited to 'docs/src')
0 files changed, 0 insertions, 0 deletions