Bug 978851 - LoadInfo::UpdateSystemLoad warns about format string in sscanf. r=padenot

This commit is contained in:
Gian-Carlo Pascutto 2014-03-06 07:53:34 +01:00
parent 32e2737215
commit 525f2cc8df

View File

@ -9,6 +9,7 @@
#include "prtime.h"
#include "prinrval.h"
#include "prsystem.h"
#include "prprf.h"
#include "nsString.h"
#include "nsThreadUtils.h"
@ -214,9 +215,9 @@ nsresult LoadInfo::UpdateSystemLoad()
uint64_t nice;
uint64_t system;
uint64_t idle;
if (sscanf(buffer.get(), "cpu %Lu %Lu %Lu %Lu",
&user, &nice,
&system, &idle) != 4) {
if (PR_sscanf(buffer.get(), "cpu %llu %llu %llu %llu",
&user, &nice,
&system, &idle) != 4) {
LOG(("Error parsing /proc/stat"));
return NS_ERROR_FAILURE;
}