]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commit
rgw: Add missing empty checks to the split string in is_string_in_set(). 56344/head
authorJoshua Baergen <jbaergen@digitalocean.com>
Tue, 12 Sep 2023 18:05:01 +0000 (14:05 -0400)
committerCasey Bodley <cbodley@redhat.com>
Wed, 20 Mar 2024 15:04:31 +0000 (11:04 -0400)
commitb5a2f9e5f1a5d2e324ccfe692693aba2ae9a3587
tree466dcbe711dc24f96185a62f9c9a2ef3f1b1189d
parentcceef281ad6b2af517d203b759bc3ddc2e81b41a
rgw: Add missing empty checks to the split string in is_string_in_set().

In certain cases, where a user misconfigures a CORS rule, the entirety
of the string can be token characters (or, at least, the string before
and after a given token is all token characters), but != "*". If the
misconfigured string includes "*" we'll try to split the string and we
assume that we can pop the list of string elements when "*" isn't
first/last, but get_str_list() won't return anything for token-only
substrings and thus 'ssplit' will have fewer elements than would be
expected for a correct rule. In the case of an empty list, front() has
undefined behaviour; in our experience, it often results in a huge
allocation attempt because the code tries to copy the string into a
local variable 'sl'.

An example of this misconfiguration (and thus a reproduction case) is
configuring an origin of " *".

Signed-off-by: Matt Benjamin <mbenjamin@redhat.com>
(cherry picked from commit 64803e1ced57d64b758927c3977bb4a4d1769180)
src/rgw/rgw_cors.cc