semihosting: Simplify softmmu_lock_user_string
commit3d5e2b4f26e077e9a8fd94659a1ce2dd49c134b7
authorRichard Henderson <richard.henderson@linaro.org>
Thu, 28 Apr 2022 04:06:58 +0000 (27 21:06 -0700)
committerRichard Henderson <richard.henderson@linaro.org>
Mon, 27 Jun 2022 23:05:06 +0000 (28 04:35 +0530)
tree333971b2cfe01a404d37c3d17e385775e50f803f
parent5f9ca6f3c5111fadb0b1e76755ceaf738a98db4c
semihosting: Simplify softmmu_lock_user_string

We are not currently bounding the search to the 1024 bytes
that we allocated, possibly overrunning the buffer.
Use softmmu_strlen_user to find the length and allocate the
correct size from the beginning.

Reviewed-by: Alex Bennée <alex.bennee@linaro.org>
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
semihosting/uaccess.c