]> git.ipfire.org Git - thirdparty/valgrind.git/commit
Move pre_check for ASCII string out of PRE(sys_prctl)
authorQuentin Monnet <quentin.monnet@netronome.com>
Sat, 14 Apr 2018 22:23:11 +0000 (23:23 +0100)
committerTom Hughes <tom@compton.nu>
Tue, 14 Aug 2018 19:47:19 +0000 (20:47 +0100)
commitc9d555dafad9215f8e9db941af012296e35106df
tree76a44e3f80804d2b575cab069c5dec2b5ed5ad96
parente752326cc050803c3bcfde1f8606bead66ff9642
Move pre_check for ASCII string out of PRE(sys_prctl)

The sys_prctl wrapper with PR_SET_NAME option reads an ASCII string passed
as its second argument. This string is supposed to be shorter than a given
limit. As the actual length of the string is unknown, the PRE() wrapper
performs a number of checks on it, including, in worst case, trying to
dereference it byte by byte.

To avoid re-implementing all this logic for other wrappers that could
need it, get the string processing out of the wrapper and move it to a
static function. Note that passing tid as an argument to the function is
required for macros PRE_MEM_RASCIIZ and PRE_MEM_READ to work properly.
coregrind/m_syswrap/syswrap-linux.c