mirror of
https://github.com/SELinuxProject/selinux
synced 2025-04-09 11:12:13 +00:00
libselinux: avoid regex serialization truncations
Check (for the probably impossible) case the serialized data is longer than the compiled fcontext format supports. Signed-off-by: Christian Göttsche <cgzones@googlemail.com> Acked-by: James Carter <jwcart2@gmail.com>
This commit is contained in:
parent
f1a8afc272
commit
4eea9948d3
@ -176,7 +176,7 @@ int regex_writef(struct regex_data *regex, FILE *fp, int do_write_precompregex)
|
||||
/* encode the pattern for serialization */
|
||||
rc = pcre2_serialize_encode((const pcre2_code **)®ex->regex,
|
||||
1, &bytes, &serialized_size, NULL);
|
||||
if (rc != 1) {
|
||||
if (rc != 1 || serialized_size >= UINT32_MAX) {
|
||||
rc = -1;
|
||||
goto out;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user