Projects
Eulaceura:Factory
mcstrans
_service:obs_scm:backport-mcstrans-check-memory...
Sign Up
Log In
Username
Password
Overview
Repositories
Revisions
Requests
Users
Attributes
Meta
File _service:obs_scm:backport-mcstrans-check-memory-allocations.patch of Package mcstrans
From 114f1bb16ead56c06b05ac4b214e1579971c5636 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Christian=20G=C3=B6ttsche?= <cgzones@googlemail.com> Date: Fri, 5 Jan 2024 19:35:34 +0100 Subject: [PATCH] mcstrans: check memory allocations MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Avoid NULL dereferences on allocation failure. Reported by GCC analyzer. Signed-off-by: Christian Göttsche <cgzones@googlemail.com> Acked-by: James Carter <jwcart2@gmail.com> --- mcstrans/src/mls_level.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/mcstrans/src/mls_level.c b/mcstrans/src/mls_level.c index 2017f117..2ee1a231 100644 --- a/mcstrans/src/mls_level.c +++ b/mcstrans/src/mls_level.c @@ -13,6 +13,8 @@ mls_level_t *mls_level_from_string(char *mls_context) } l = (mls_level_t *) calloc(1, sizeof(mls_level_t)); + if (!l) + return NULL; /* Extract low sensitivity. */ scontextp = p = mls_context; @@ -124,6 +126,9 @@ char *mls_level_to_string(mls_level_t *l) if (len == 0) return NULL; char *result = (char *)malloc(len + 1); + if (!result) + return NULL; + char *p = result; p += sprintf(p, "s%d", l->sens); -- 2.33.0
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