diff options
| author | Eric Blake | 2018-12-06 16:18:56 +0100 |
|---|---|---|
| committer | Laurent Vivier | 2018-12-11 18:28:47 +0100 |
| commit | 53a90b97245982bf28fbd2c776f206ac25a3837c (patch) | |
| tree | 700a09e69b5748a8144304cec9dcdd5dfd252af1 /scripts/qapi | |
| parent | util: vfio-helpers: use ARRAY_SIZE in qemu_vfio_init_pci() (diff) | |
| download | qemu-53a90b97245982bf28fbd2c776f206ac25a3837c.tar.gz qemu-53a90b97245982bf28fbd2c776f206ac25a3837c.tar.xz qemu-53a90b97245982bf28fbd2c776f206ac25a3837c.zip | |
cutils: Assert in-range base for string-to-integer conversions
POSIX states that the value of endptr is unspecified if strtol()
fails with EINVAL due to an invalid base argument. Since none of
the callers to check_strtox_error() initialized endptr, we could
end up propagating uninitialized data back to a caller on error.
However, passing an out-of-range base is already a sign of poor
programming, so let's just assert that base is in range, at which
point check_strtox_error() can be tightened to assert that it is
receiving an initialized ep that points somewhere within the
caller's original string, regardless of whether strto*() succeeded
or failed with ERANGE.
Reported-by: Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com>
Signed-off-by: Eric Blake <eblake@redhat.com>
Reviewed-by: Markus Armbruster <armbru@redhat.com>
Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com>
Message-Id: <20181206151856.77503-1-eblake@redhat.com>
Signed-off-by: Laurent Vivier <laurent@vivier.eu>
Diffstat (limited to 'scripts/qapi')
0 files changed, 0 insertions, 0 deletions
