Sign Up
Log In
Log In
or
Sign Up
Places
All Projects
Status Monitor
Collapse sidebar
SUSE:SLE-15-SP7:GA
qemu-linux-user.20748
0214-qom-code-hardening-have-bound-check.patch
Overview
Repositories
Revisions
Requests
Users
Attributes
Meta
File 0214-qom-code-hardening-have-bound-check.patch of Package qemu-linux-user.20748
From: Ani Sinha <ani@anisinha.ca> Date: Mon, 21 Sep 2020 15:03:25 +0530 Subject: qom: code hardening - have bound checking while looping with integer value MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Git-commit: 1bf8b88f144bee747e386c88d45d772e066bbb36 References: bsc#1187529 CVE-2021-3611 Object property insertion code iterates over an integer to get an unused index that can be used as an unique name for an object property. This loop increments the integer value indefinitely. Although very unlikely, this can still cause an integer overflow. In this change, we fix the above code by checking against INT16_MAX and making sure that the interger index does not overflow beyond that value. If no available index is found, the code would cause an assertion failure. This assertion failure is necessary because the callers of the function do not check the return value for NULL. Signed-off-by: Ani Sinha <ani@anisinha.ca> Signed-off-by: Eduardo Habkost <ehabkost@redhat.com> Reviewed-by: Daniel P. Berrangé <berrange@redhat.com> Message-Id: <20200921093325.25617-1-ani@anisinha.ca> Signed-off-by: Eduardo Habkost <ehabkost@redhat.com> Signed-off-by: Cho, Yu-Chen <acho@suse.com> --- qom/object.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/qom/object.c b/qom/object.c index 547dcf97c3c53415e32d14dd4c39..616cfcf40d5d5767911894f62c19 100644 --- a/qom/object.c +++ b/qom/object.c @@ -998,11 +998,11 @@ object_property_add(Object *obj, const char *name, const char *type, if (name_len >= 3 && !memcmp(name + name_len - 3, "[*]", 4)) { int i; - ObjectProperty *ret; + ObjectProperty *ret = NULL; char *name_no_array = g_strdup(name); name_no_array[name_len - 3] = '\0'; - for (i = 0; ; ++i) { + for (i = 0; i < INT16_MAX; ++i) { char *full_name = g_strdup_printf("%s[%d]", name_no_array, i); ret = object_property_add(obj, full_name, type, get, set, @@ -1013,6 +1013,7 @@ object_property_add(Object *obj, const char *name, const char *type, } } g_free(name_no_array); + assert(ret); return ret; }
Locations
Projects
Search
Status Monitor
Help
OpenBuildService.org
Documentation
API Documentation
Code of Conduct
Contact
Support
@OBShq
Terms
openSUSE Build Service is sponsored by
The Open Build Service is an
openSUSE project
.
Sign Up
Log In
Places
Places
All Projects
Status Monitor