| 1 |
Authorscip-debian debian i7z 0.27.2+git2013.10.12-g5023138-8 i7z/patches/`fix-insecure-tempfile.patch`#Author.: Andreas Beckmann <[email protected]scip-debian . . . identity/`[email protected]`.> |
| 2 |
Descriptionscip-debian debian i7z 0.27.2+git2013.10.12-g5023138-8 i7z/patches/`fix-insecure-tempfile.patch`#Description.: fix insecure temfile usage: /tmp/cpufreq.txt |
| 3 |
switch from system() + fopen() to popen() |
| 4 |
disable other insecure tempfiles that may be generated but not used |
| 5 |
Bug-Debianscip-debian debian i7z 0.27.2+git2013.10.12-g5023138-8 i7z/patches/`fix-insecure-tempfile.patch`#Bug-Debian.: https://bugs.debian.org/718418scip-debian-bts debian-bts . . 718418: |
| 6 |
|
| 7 |
diff --git a/GUI/i7z_GUI.cppscip-debian debian i7z 0.27.2+git2013.10.12-g5023138-8 i7z/upstream/`GUI/i7z_GUI.cpp`: b/GUI/i7z_GUI.cppscip-debian debian i7z 0.27.2+git2013.10.12-g5023138-8 i7z/upstream/`GUI/i7z_GUI.cpp`: |
| 8 |
index 2705e84..60eaeb2 100644 |
| 9 |
--- a/GUI/i7z_GUI.cpp |
| 10 |
+++ b/GUI/i7z_GUI.cpp |
| 11 |
@@ -171,18 +171,17 @@ MyThread::run () |
| 12 |
//CPUINFO is wrong for i7 but correct for the number of physical and logical cores present |
| 13 |
//If Hyperthreading is enabled then, multiple logical processors will share a common CORE ID |
| 14 |
//http://www.redhat.com/magazine/022aug06/departments/tips_tricks/ |
| 15 |
|
| 16 |
|
| 17 |
|
| 18 |
+ //system ("grep \"core id\" /proc/cpuinfo |sort -|uniq -|wc -l > /tmp/numPhysical.txt"); |
| 19 |
+ //system ("grep \"processor\" /proc/cpuinfo |sort -|uniq -|wc -l > /tmp/numLogical.txt"); |
| 20 |
|
| 21 |
|
| 22 |
|
| 23 |
+ // obtain the cpufreq from /proc/cpuinfo |
| 24 |
FILE *tmp_file; |
| 25 |
|
| 26 |
+ tmp_file = popen ("sed -n '/MHz/ { s/cpu\\sMHz\\s*:\\s//p; q }' /proc/cpuinfo", "r"); |
| 27 |
char tmp_str[30]; |
| 28 |
fgets (tmp_str, 30, tmp_file); |
| 29 |
+ pclose (tmp_file); |
| 30 |
double cpu_freq_cpuinfo = atof (tmp_str); |
| 31 |
|
| 32 |
|
| 33 |
unsigned int numPhysicalCores, numLogicalCores; |
| 34 |
numPhysicalCores = socket_0.num_physical_cores + socket_1.num_physical_cores; |
| 35 |
diff --git a/helper_functions.cscip-debian debian i7z 0.27.2+git2013.10.12-g5023138-8 i7z/upstream/`helper_functions.c`: b/helper_functions.cscip-debian debian i7z 0.27.2+git2013.10.12-g5023138-8 i7z/upstream/`helper_functions.c`: |
| 36 |
index 2f8da87..906c298 100644 |
| 37 |
--- a/helper_functions.c |
| 38 |
+++ b/helper_functions.c |
| 39 |
@@ -531,16 +531,13 @@ double cpufreq_info() |
| 40 |
//CPUINFO is wrong for i7 but correct for the number of physical and logical cores present |
| 41 |
//If Hyperthreading is enabled then, multiple logical processors will share a common CORE ID |
| 42 |
//http://www.redhat.com/magazine/022aug06/departments/tips_tricks/ |
| 43 |
|
| 44 |
|
| 45 |
|
| 46 |
|
| 47 |
|
| 48 |
+ // obtain the cpufreq from /proc/cpuinfo |
| 49 |
FILE *tmp_file; |
| 50 |
|
| 51 |
+ tmp_file = popen ("sed -n '/MHz/ { s/cpu\\sMHz\\s*:\\s//p; q }' /proc/cpuinfo", "r"); |
| 52 |
char tmp_str[30]; |
| 53 |
fgets (tmp_str, 30, tmp_file); |
| 54 |
|
| 55 |
+ pclose (tmp_file); |
| 56 |
return atof(tmp_str); |
| 57 |
} |
| 58 |
|
| 59 |
diff --git a/i7z_Single_Socket.cscip-debian debian i7z 0.27.2+git2013.10.12-g5023138-8 i7z/upstream/`i7z_Single_Socket.c`: b/i7z_Single_Socket.cscip-debian debian i7z 0.27.2+git2013.10.12-g5023138-8 i7z/upstream/`i7z_Single_Socket.c`: |
| 60 |
index 015f154..d0afee0 100644 |
| 61 |
--- a/i7z_Single_Socket.c |
| 62 |
+++ b/i7z_Single_Socket.c |
| 63 |
@@ -823,10 +823,13 @@ void print_i7z_single () |
| 64 |
//CPUINFO is wrong for i7 but correct for the number of physical and logical cores present |
| 65 |
//If Hyperthreading is enabled then, multiple logical processors will share a common CORE ID |
| 66 |
//http://www.redhat.com/magazine/022aug06/departments/tips_tricks/ |
| 67 |
+ERROR INSECURE TMPFILE |
| 68 |
system |
| 69 |
("cat /proc/cpuinfo |grep MHz|sed 's/cpu\\sMHz\\s*:\\s//'|tail -n 1 > /tmp/cpufreq.txt"); |
| 70 |
+ERROR INSECURE TMPFILE |
| 71 |
system |
| 72 |
("grep \"core id\" /proc/cpuinfo |sort -|uniq -|wc -l > /tmp/numPhysical.txt"); |
| 73 |
+ERROR INSECURE TMPFILE |
| 74 |
system |
| 75 |
("grep \"processor\" /proc/cpuinfo |sort -|uniq -|wc -l > /tmp/numLogical.txt"); |
| 76 |
//At this step, /tmp/numPhysical contains number of physical cores in machine and |