should prevent a buffer overflow in tagbuffer

Signed-off-by: gregory guy <g-gregory@gmx.fr>
(cherry picked from commit e816bb8048)
r14.0.x
gregory guy 6 years ago committed by Michele Calgaro
parent 155acafd18
commit 604bc6503d
Signed by: MicheleC
GPG Key ID: 2A75B7CA8ADED5CF

@ -171,7 +171,7 @@ void KCPUProc::readLoad() {
// ========== Linux-specific (begin) ========== // ========== Linux-specific (begin) ==========
#ifdef Q_OS_LINUX #ifdef Q_OS_LINUX
bool KCPUProc::CPU::parse(FILE* fd) { bool KCPUProc::CPU::parse(FILE* fd) {
char tagbuffer[32]; char tagbuffer[32+1];
Ticks n; // new ticks Ticks n; // new ticks
if (fscanf(fd, "%32s%d%d%d%d", tagbuffer, &n.U, &n.N, &n.S, &n.I) != 5) { if (fscanf(fd, "%32s%d%d%d%d", tagbuffer, &n.U, &n.N, &n.S, &n.I) != 5) {
return false; // failure return false; // failure

Loading…
Cancel
Save