Sign Up
Log In
Log In
or
Sign Up
Places
All Projects
Status Monitor
Collapse sidebar
home:wolfi323:branches:KDE:Frameworks5
ksysguard5
0001-lmsensors-Fix-buffer-size-passed-to-snprin...
Overview
Repositories
Revisions
Requests
Users
Attributes
Meta
File 0001-lmsensors-Fix-buffer-size-passed-to-snprintf.patch of Package ksysguard5
From cb52be2f743a6717355445889dd3e2e265ad75fa Mon Sep 17 00:00:00 2001 From: Fabian Vogt <fabian@ritter-vogt.de> Date: Sat, 18 Jun 2022 14:39:41 +0200 Subject: [PATCH] lmsensors: Fix buffer size passed to snprintf Pass the actual size of the buffer to snprintf, otherwise the program aborts if built with _FORTIFY_SOURCE=3. --- ksysguardd/Linux/lmsensors.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/ksysguardd/Linux/lmsensors.c b/ksysguardd/Linux/lmsensors.c index d55c55c4..63097f7f 100644 --- a/ksysguardd/Linux/lmsensors.c +++ b/ksysguardd/Linux/lmsensors.c @@ -164,10 +164,11 @@ void initLmSensors( struct SensorModul* sm ) label = sensors_get_label( scn, sf ); sensors_snprintf_chip_name(scnbuf, BUFFER_SIZE_LMSEN, scn); p = (LMSENSOR*)malloc( sizeof( LMSENSOR ) ); - p->fullName = (char*)malloc( strlen( "lmsensors/" ) + - strlen( scnbuf ) + 1 + - strlen( label ) + 1 ); - snprintf( p->fullName, BUFFER_SIZE_LMSEN, "lmsensors/%s/%s", scnbuf, label ); + const int fullNameLen = strlen( "lmsensors/" ) + + strlen( scnbuf ) + 1 + + strlen( label ) + 1; + p->fullName = (char*)malloc( fullNameLen ); + snprintf( p->fullName, fullNameLen, "lmsensors/%s/%s", scnbuf, label ); /* Make sure that name contains only proper characters. */ for ( s = p->fullName; *s; s++ ) -- 2.36.1
Locations
Projects
Search
Status Monitor
Help
OpenBuildService.org
Documentation
API Documentation
Code of Conduct
Contact
Support
@OBShq
Terms
openSUSE Build Service is sponsored by
The Open Build Service is an
openSUSE project
.
Sign Up
Log In
Places
Places
All Projects
Status Monitor