diff options
author | Markus Armbruster <armbru@redhat.com> | 2017-02-21 21:13:46 +0100 |
---|---|---|
committer | Markus Armbruster <armbru@redhat.com> | 2017-02-23 20:35:35 +0100 |
commit | 8ee8409eff5643c677d6e5dce6620355a89c80f8 (patch) | |
tree | fa3962a96b3ea7d7dab7270012da14828f9172bc /util/qdist.c | |
parent | 694baf57ae103954e2337d1fa22d1dcdfa8e2f5a (diff) | |
download | qemu-8ee8409eff5643c677d6e5dce6620355a89c80f8.zip qemu-8ee8409eff5643c677d6e5dce6620355a89c80f8.tar.gz qemu-8ee8409eff5643c677d6e5dce6620355a89c80f8.tar.bz2 |
option: Assert value string isn't null
Plenty of code relies on QemuOpt member @str not being null, including
qemu_opts_print(), qemu_opts_to_qdict(), and callbacks passed to
qemu_opt_foreach().
Begs the question whether it can be null. Only opt_set() creates
QemuOpt. It sets member @str to its argument @value. Passing null
for @value would plant a time bomb. Callers:
* opts_do_parse() can't pass null.
* qemu_opt_set() passes its argument @value. Callers:
- qemu_opts_from_qdict_1() can't pass null
- qemu_opts_set() passes its argument @value, but none of its
callers pass null.
- Many more outside qemu-option.c, but they shouldn't pass null,
either.
Assert member @str isn't null, so that misuse is caught right away.
Simplify parse_option_bool(), parse_option_number() and
parse_option_size() accordingly. Best viewed with whitespace changes
ignored.
Signed-off-by: Markus Armbruster <armbru@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
Message-Id: <1487708048-2131-3-git-send-email-armbru@redhat.com>
Diffstat (limited to 'util/qdist.c')
0 files changed, 0 insertions, 0 deletions