Projects
Mega:23.09
libsepol
_service:tar_scm:backport-libsepol-check-for-ov...
Sign Up
Log In
Username
Password
Overview
Repositories
Revisions
Requests
Users
Attributes
Meta
File _service:tar_scm:backport-libsepol-check-for-overflow-in-put_entry.patch of Package libsepol
From df666f70534ef225b97899f997b4077aeb285972 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Christian=20G=C3=B6ttsche?= <cgzones@googlemail.com> Date: Thu, 6 Jul 2023 15:57:18 +0200 Subject: [PATCH] libsepol: check for overflow in put_entry() MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit put_entry() is used during writing binary policies. Avoid short writes due to an overflow. Signed-off-by: Christian Göttsche <cgzones@googlemail.com> Acked-by: James Carter <jwcart2@gmail.com> --- libsepol/src/services.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/libsepol/src/services.c b/libsepol/src/services.c index 72772dbd29..6bddc287e1 100644 --- a/libsepol/src/services.c +++ b/libsepol/src/services.c @@ -1711,7 +1711,10 @@ int next_entry(void *buf, struct policy_file *fp, size_t bytes) size_t put_entry(const void *ptr, size_t size, size_t n, struct policy_file *fp) { - size_t bytes = size * n; + size_t bytes; + + if (__builtin_mul_overflow(size, n, &bytes)) + return 0; switch (fp->type) { case PF_USE_STDIO:
Locations
Projects
Search
Status Monitor
Help
Open Build Service
OBS Manuals
API Documentation
OBS Portal
Reporting a Bug
Contact
Mailing List
Forums
Chat (IRC)
Twitter
Open Build Service (OBS)
is an
openSUSE project
.
浙ICP备2022010568号-2