powertop/powertop-segfault.diff

21 lines
567 B
Diff
Raw Normal View History

--- config.c
+++ config.c
@@ -33,7 +33,7 @@
#include "powertop.h"
/* static arrays are not nice programming.. but they're easy */
-static char configlines[5000][100];
+static char configlines[8000][100];
static int configcount;
static void read_kernel_config(void)
@@ -45,7 +45,7 @@
return;
if (access("/proc/config.gz", R_OK) == 0) {
file = popen("zcat /proc/config.gz 2> /dev/null", "r");
- while (file && !feof(file)) {
+ while (file && !feof(file) && configcount < 7999) {
char line[100];
if (fgets(line, 100, file) == NULL)
break;