Projects
Eulaceura:Mainline
mdadm
_service:obs_scm:0025-mdadm-lib.c-fix-coverity-...
Sign Up
Log In
Username
Password
Overview
Repositories
Revisions
Requests
Users
Attributes
Meta
File _service:obs_scm:0025-mdadm-lib.c-fix-coverity-issues.patch of Package mdadm
From da7aecdf25371e1476da4ec56e9ec5ddf13af5da Mon Sep 17 00:00:00 2001 From: Nigel Croxon <ncroxon@redhat.com> Date: Tue, 16 Jul 2024 07:20:10 -0400 Subject: [PATCH] mdadm: lib.c fix coverity issues Fixing the following coding errors the coverity tools found: * Event fixed_size_dest: You might overrun the 32-character fixed-size string "devnm" by copying "cp + 1" without checking the length. * Event fixed_size_dest: You might overrun the 32-character fixed-size string "devnm" by copying "cp" without checking the length. Signed-off-by: Nigel Croxon <ncroxon@redhat.com> --- lib.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib.c b/lib.c index 2b09293c..13d4e4f1 100644 --- a/lib.c +++ b/lib.c @@ -109,7 +109,7 @@ char *devid2kname(dev_t devid) link[n] = 0; cp = strrchr(link, '/'); if (cp) { - strcpy(devnm, cp + 1); + snprintf(devnm, sizeof(devnm), "%s", cp + 1); return devnm; } } @@ -159,7 +159,7 @@ char *devid2devnm(dev_t devid) ep = strchr(cp, '/'); if (ep) *ep = 0; - strcpy(devnm, cp); + snprintf(devnm, sizeof(devnm), "%s", cp); return devnm; } } -- 2.39.2
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