]> git.ipfire.org Git - people/jschlag/ipfire-2.x.git/commitdiff
setup: Fix segmentation fault with more than four NICs found
authorMichael Tremer <michael.tremer@ipfire.org>
Thu, 10 Mar 2016 19:22:04 +0000 (19:22 +0000)
committerMichael Tremer <michael.tremer@ipfire.org>
Thu, 10 Mar 2016 19:22:04 +0000 (19:22 +0000)
Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
src/setup/netstuff.c
src/setup/setup.h

index f5b3849893e0784f63ba8cdf6752d50c45588766..240306e97171e8a9cdfd45039be19a6e5e224400 100644 (file)
@@ -601,16 +601,16 @@ int scan_network_cards(void)
 int nicmenu(int colour)
 {
        int rc, choise = 0, count = 0, kcount = 0, mcount = 0, i, j, nic_in_use;
-       int found_NIC_as_Card[4];
+       int found_NIC_as_Card[MAX_NICS];
        char message[STRING_SIZE];
        char temp[STRING_SIZE];
 
        char cMenuInhalt[STRING_SIZE];
-       char MenuInhalt[20][180];
-       char *pMenuInhalt[20];
+       char MenuInhalt[MAX_NICS][STRING_SIZE];
+       char *pMenuInhalt[MAX_NICS];
        
        while (strcmp(nics[count].macaddr, "")) count++;                        // 2 find how many nics in system
-       for ( i=0 ; i<4;i++) if (strcmp(knics[i].macaddr, "")) kcount++;        // loop to find all knowing nics
+       for (i=0; i<MAX_NICS; i++) if (strcmp(knics[i].macaddr, "")) kcount++;  // loop to find all knowing nics
 
        // If new nics are found...
        if (count > kcount) {
index 14fd64634bd4ef3ad09f33be14f86c75610d863c..a368b78ae108223aa93812f4555121a77ccc3f43 100644 (file)
@@ -55,6 +55,8 @@ int handletimezone(void);
 #define _ORANGE_CARD_ 2
 #define _BLUE_CARD_ 3
 
+#define MAX_NICS 20
+
 struct nic
 {
        char driver[80];