Projects
Mega:24.03:SP1:Everything
thin-provisioning-tools
_service:tar_scm:0013-thin_metadata_size-Fix-po...
Sign Up
Log In
Username
Password
Overview
Repositories
Revisions
Requests
Users
Attributes
Meta
File _service:tar_scm:0013-thin_metadata_size-Fix-potential-string-overflow.patch of Package thin-provisioning-tools
From 3145a1f4ded700cfda3f2dffc203cc5c3cfb1d13 Mon Sep 17 00:00:00 2001 From: Ming-Hung Tsai <mtsai@redhat.com> Date: Wed, 2 Jun 2021 11:39:01 +0800 Subject: [PATCH] [thin_metadata_size] Fix potential string overflow --- thin-provisioning/thin_metadata_size.cc | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/thin-provisioning/thin_metadata_size.cc b/thin-provisioning/thin_metadata_size.cc index b6a5718e..f14696c3 100644 --- a/thin-provisioning/thin_metadata_size.cc +++ b/thin-provisioning/thin_metadata_size.cc @@ -192,9 +192,13 @@ static void printf_aligned(struct global *g, char const *a, char const *b, char { char buf[80]; - strcpy(buf, b); - if (units) - strcat(buf, mandatory ? "{" :"["), strcat(buf, g->unit.chars), strcat(buf, mandatory ? "}" : "]"); + if (units) { + char left_bracket = mandatory ? '{' : '['; + char right_bracket = mandatory ? '}' : ']'; + snprintf(buf, 80, "%s%c%s%c", b, left_bracket, g->unit.chars, right_bracket); + } else { + snprintf(buf, 80, "%s", b); + } printf("\t%-4s%-44s%s\n", a, buf, c); }
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