All pastes #1389806 Raw Edit

mdk3-v5-gcc-4.3.diff

public text v1 · immutable
#1389806 ·published 2009-04-12 18:08 UTC
rendered paste body
diff -Naur mdk3-v5.orig/mdk3.c mdk3-v5/mdk3.c
--- mdk3-v5.orig/mdk3.c	2008-11-10 20:45:02.000000000 +0000
+++ mdk3-v5/mdk3.c	2009-04-12 09:21:01.000000000 +0000
@@ -3345,7 +3345,7 @@
 
     if ((argc < 3) || (strlen(argv[2]) != 1))
     {
-	printf(use_head);
+	printf("%s", use_head);
 	return -1;
     }
 
@@ -3361,11 +3361,11 @@
 	    if (! strcmp(argv[t], "-n")) if (argc > t+1) ssid = argv[t+1];
 	    if (! strcmp(argv[t], "-f")) if (argc > t+1) {
 		if (ssid_file_name == NULL) ssid_file_name = argv[t+1];
-		else { printf(use_beac); return -1; }
+		else { printf("%s", use_beac); return -1; }
 	    }
 	    if (! strcmp(argv[t], "-v")) if (argc > t+1) {
 		if (ssid_file_name == NULL) { ssid_file_name = argv[t+1]; adv=1; }
-		else { printf(use_beac); return -1; }
+		else { printf("%s", use_beac); return -1; }
 	    }
 	    if (! strcmp(argv[t], "-s")) if (argc > t+1) pps = strtol(argv[t+1], (char **) NULL, 10);
 	    if (! strcmp(argv[t], "-c")) if (argc > t+1) fchan = strtol(argv[t+1], (char **) NULL, 10);
@@ -3383,12 +3383,12 @@
 	for (t=3; t<argc; t++)
 	{
 	    if (! strcmp(argv[t], "-a")) {
-		  if (! argc > t+1) { printf(use_auth); return -1; }
+		  if (! argc > t+1) { printf("%s", use_auth); return -1; }
 		  ap = (uchar *) parse_mac(argv[t+1]);
 		  mode = 'A';
 	    }
         if (! strcmp(argv[t], "-i")) {
-		  if (! argc > t+1) { printf(use_auth); return -1; }
+		  if (! argc > t+1) { printf("%s", use_auth); return -1; }
 		  target = (uchar *) parse_mac(argv[t+1]);
 		  mode = 'i';
 		  usespeed = 1; pps = 500;
@@ -3446,7 +3446,7 @@
 		printf("\nSSID Wordlist Mode activated!\n");
 	    }
 	    if (! strcmp(argv[t], "-t")) {
-		if (! argc > t+1) { printf(use_prob); return -1; }
+		if (! argc > t+1) { printf("%s", use_prob); return -1; }
 		target = (uchar *) parse_mac(argv[t+1]);
 	    }
 	    if (! strcmp(argv[t], "-s")) if (argc > t+1) {
@@ -3487,7 +3487,7 @@
 	for (t=3; t<argc; t++)
 	{
 	    if (! strcmp(argv[t], "-t")) {
-		if (! (argc > t+1)) { printf(use_mich); return -1; }
+		if (! (argc > t+1)) { printf("%s", use_mich); return -1; }
 		target = (uchar *) parse_mac(argv[t+1]);
 	    }
 	    if (! strcmp(argv[t], "-n")) if (argc > t+1) {
@@ -3507,7 +3507,7 @@
     break;
     case 'x':
 	mode = 'x';
-        if (argc < 4) { printf(use_eapo); return -1; }
+        if (argc < 4) { printf("%s", use_eapo); return -1; }
         eapol_test = strtol(argv[3], (char **) NULL, 10);
         usespeed = 1;
         pps = 400;
@@ -3517,16 +3517,16 @@
 	for (t=4; t<argc; t = t + 2)
 	{
 	    if (! strcmp(argv[t], "-n")) {
-              if (! (argc > t+1)) { printf(use_eapo); return -1; }
+              if (! (argc > t+1)) { printf("%s", use_eapo); return -1; }
               ssid = argv[t + 1];
 	    }
 	    if (! strcmp(argv[t], "-t")) {
-		if (! (argc > t+1)) { printf(use_eapo); return -1; }
+		if (! (argc > t+1)) { printf("%s", use_eapo); return -1; }
 		target = (uchar *) parse_mac(argv[t+1]);
                 memcpy(eapol_dst, target, ETH_MAC_LEN);
 	    }
 	    if (! strcmp(argv[t], "-c")) {
-		if (! (argc > t+1)) { printf(use_eapo); return -1; }
+		if (! (argc > t+1)) { printf("%s", use_eapo); return -1; }
 		mac_sa = (uchar *) parse_mac(argv[t+1]);
                 memcpy(eapol_src, mac_sa, ETH_MAC_LEN);
 	    }
@@ -3554,12 +3554,12 @@
 		usespeed = 1;
 	    }
 	    if (! strcmp(argv[t], "-w")) if (argc > t+1) {
-		if (wblist != 0) { printf(use_deau); return -1; }
+		if (wblist != 0) { printf("%s", use_deau); return -1; }
 		load_whitelist(argv[t+1]);
 		wblist = 1;
 	    }
 	    if (! strcmp(argv[t], "-b")) if (argc > t+1) {
-		if (wblist != 0) { printf(use_deau); return -1; }
+		if (wblist != 0) { printf("%s", use_deau); return -1; }
 		load_whitelist(argv[t+1]);
 		wblist = 2;
 	    }
@@ -3580,17 +3580,17 @@
 	for (t=3; t<argc; t++)
 	{
 	    if (! strcmp(argv[t], "-t")) {
-		if (! (argc > t+1)) { printf(use_macb); return -1; }
+		if (! (argc > t+1)) { printf("%s", use_macb); return -1; }
 		uchar *tmp_mac_addr = (uchar *) parse_mac(argv[t+1]);
 		target = malloc(6);
 		memcpy(target, tmp_mac_addr, 6);
 	    }
 	    if (! strcmp(argv[t], "-m")) {
-		if (! (argc > t+1)) { printf(use_macb); return -1; }
+		if (! (argc > t+1)) { printf("%s", use_macb); return -1; }
 		mac_base = (uchar *) parse_half_mac(argv[t+1]);
 	    }
 	    if (! strcmp(argv[t], "-f")) {
-		if (! (argc > t+1)) { printf(use_macb); return -1; }
+		if (! (argc > t+1)) { printf("%s", use_macb); return -1; }
 		uchar *tmp_mac_addr = (uchar *) parse_mac(argv[t+1]);
 		mac_base = (uchar *) malloc(3);
 		mac_lower = (uchar *) malloc(3);
@@ -3605,7 +3605,7 @@
 	for (t=3; t<argc; t++)
 	{
 	    if (! strcmp(argv[t], "-t")) {
-		if (! (argc > t+1)) { printf(use_wpad); return -1; }
+		if (! (argc > t+1)) { printf("%s", use_wpad); return -1; }
 		uchar *tmp_mac_addr = (uchar *) parse_mac(argv[t+1]);
 		target = malloc(6);
 		memcpy(target, tmp_mac_addr, 6);
@@ -3613,7 +3613,7 @@
 	}
    break;
     default:
-	printf(use_head);
+	printf("%s", use_head);
 	return -1;
 	break;
     }
@@ -3622,7 +3622,7 @@
 
     if ((mode == 'w') && (got_ssid == 0)) {
 	printf("Please specify a target ESSID!\n\n");
-	printf(use_wids);
+	printf("%s", use_wids);
 	return -1;
     }
     if ((mode == 'P') && (usespeed == 0)) {
@@ -3805,64 +3805,64 @@
 
     if( argc < 2 )
     {
-	printf(use_head);
+	printf("%s", use_head);
         return( 1 );
     }
 
     if( !memcmp(argv[1], "--help", 6))
     {
 	if( argc < 3 ) {
-	    printf(use_head);
+	    printf("%s", use_head);
             return( 1 );
 	}
 
 	switch (argv[2][0]) {
 	    case 'b':
-		printf(use_beac);
+		printf("%s", use_beac);
 		break;
 	    case 'a':
-		printf(use_auth);
+		printf("%s", use_auth);
 		break;
 	    case 'p':
-		printf(use_prob);
+		printf("%s", use_prob);
 		break;
 	    case 'd':
-		printf(use_deau);
+		printf("%s", use_deau);
 		break;
 	    case 'm':
-		printf(use_mich);
+		printf("%s", use_mich);
 		break;
 	    case 'x':
-		printf(use_eapo);
+		printf("%s", use_eapo);
 		break;
 	    case 'w':
-		printf(use_wids);
+		printf("%s", use_wids);
 		break;
 	    case 'f':
-		printf(use_macb);
+		printf("%s", use_macb);
 		break;
 	    case 'g':
-		printf(use_wpad);
+		printf("%s", use_wpad);
 		break;
 	    default:
-		printf(use_head);
+		printf("%s", use_head);
         }
 	return(0);
     }
 
     if( !memcmp(argv[1], "--fullhelp", 10))
     {
-	printf(use_head);
+	printf("%s", use_head);
 	printf("\n\n");
-	printf(use_beac);
-	printf(use_auth);
-	printf(use_prob);
-	printf(use_deau);
-	printf(use_mich);
-	printf(use_eapo);
-	printf(use_wids);
-	printf(use_macb);
-	printf(use_wpad);
+	printf("%s", use_beac);
+	printf("%s", use_auth);
+	printf("%s", use_prob);
+	printf("%s", use_deau);
+	printf("%s", use_mich);
+	printf("%s", use_eapo);
+	printf("%s", use_wids);
+	printf("%s", use_macb);
+	printf("%s", use_wpad);
 	return (0);
     }
 
diff -Naur mdk3-v5.orig/osdep/linux.c mdk3-v5/osdep/linux.c
--- mdk3-v5.orig/osdep/linux.c	2008-05-07 21:43:51.000000000 +0000
+++ mdk3-v5/osdep/linux.c	2009-04-12 08:54:52.000000000 +0000
@@ -158,10 +158,10 @@
 //Check if the driver is ndiswrapper */
 static int is_ndiswrapper(const char * iface, const char * path)
 {
-    int n,pid;
+    int n, pid, unused;
     if ((pid=fork())==0)
     {
-        close( 0 ); close( 1 ); close( 2 ); chdir( "/" );
+        close( 0 ); close( 1 ); close( 2 ); unused = chdir( "/" );
         execl(path, "iwpriv",iface, "ndis_reset", NULL);
         exit( 1 );
     }
@@ -321,7 +321,7 @@
     struct ifreq ifr;
     struct iwreq wrq;
     char s[32];
-    int pid, status;
+    int pid, status, unused;
 
     memset(s, 0, sizeof(s));
 
@@ -352,7 +352,7 @@
 
         if( ( pid = fork() ) == 0 )
         {
-            close( 0 ); close( 1 ); close( 2 ); chdir( "/" );
+            close( 0 ); close( 1 ); close( 2 ); unused = chdir( "/" );
             execlp(dev->iwconfig, "iwconfig", wi_get_ifname(wi),
                     "rate", s, NULL );
             exit( 1 );
@@ -715,7 +715,7 @@
 {
     struct priv_linux *dev = wi_priv(wi);
     char s[32];
-    int pid, status;
+    int pid, status, unused;
     struct iwreq wrq;
 
     memset( s, 0, sizeof( s ) );
@@ -726,7 +726,7 @@
 
         if( ( pid = fork() ) == 0 )
         {
-            close( 0 ); close( 1 ); close( 2 ); chdir( "/" );
+            close( 0 ); close( 1 ); close( 2 ); unused = chdir( "/" );
             execl( dev->wlanctlng, "wlanctl-ng", wi_get_ifname(wi),
                     "lnxreq_wlansniff", s, NULL );
             exit( 1 );
@@ -748,7 +748,7 @@
 
         if( ( pid = fork() ) == 0 )
         {
-            close( 0 ); close( 1 ); close( 2 ); chdir( "/" );
+            close( 0 ); close( 1 ); close( 2 ); unused = chdir( "/" );
             execlp( dev->iwpriv, "iwpriv", wi_get_ifname(wi),
                     "monitor", "1", s, NULL );
             exit( 1 );
@@ -764,7 +764,7 @@
 
         if( ( pid = fork() ) == 0 )
         {
-            close( 0 ); close( 1 ); close( 2 ); chdir( "/" );
+            close( 0 ); close( 1 ); close( 2 ); unused = chdir( "/" );
             execlp(dev->iwconfig, "iwconfig", wi_get_ifname(wi),
                     "channel", s, NULL );
             exit( 1 );
@@ -804,7 +804,7 @@
 {
     struct priv_linux *dev = wi_priv(wi);
     char s[32];
-    int pid, status;
+    int pid, status, unused;
     struct iwreq wrq;
 
     memset( s, 0, sizeof( s ) );
@@ -817,7 +817,7 @@
 
         if( ( pid = fork() ) == 0 )
         {
-            close( 0 ); close( 1 ); close( 2 ); chdir( "/" );
+            close( 0 ); close( 1 ); close( 2 ); unused = chdir( "/" );
             execlp(dev->iwconfig, "iwconfig", wi_get_ifname(wi),
                     "freq", s, NULL );
             exit( 1 );
@@ -930,7 +930,7 @@
 
 int set_monitor( struct priv_linux *dev, char *iface, int fd )
 {
-    int pid, status;
+    int pid, status, unused;
     struct iwreq wrq;
 
     if( strcmp(iface,"prism0") == 0 )
@@ -938,7 +938,7 @@
         dev->wl = wiToolsPath("wl");
         if( ( pid = fork() ) == 0 )
         {
-            close( 0 ); close( 1 ); close( 2 ); chdir( "/" );
+            close( 0 ); close( 1 ); close( 2 ); unused = chdir( "/" );
             execl( dev->wl, "wl", "monitor", "1", NULL);
             exit( 1 );
         }
@@ -955,10 +955,9 @@
     {
         switch(dev->drivertype) {
         case DT_WLANNG:
-//            snprintf( s,  sizeof( s ) - 1, "channel=%d", channel );
             if( ( pid = fork() ) == 0 )
             {
-                close( 0 ); close( 1 ); close( 2 ); chdir( "/" );
+                close( 0 ); close( 1 ); close( 2 ); unused = chdir( "/" );
                 execl( dev->wlanctlng, "wlanctl-ng", iface,
                         "lnxreq_wlansniff", "enable=true",
                         "prismheader=true", "wlanheader=false",
@@ -977,7 +976,7 @@
         case DT_ORINOCO:
             if( ( pid = fork() ) == 0 )
             {
-                close( 0 ); close( 1 ); close( 2 ); chdir( "/" );
+                close( 0 ); close( 1 ); close( 2 ); unused = chdir( "/" );
                 execlp( dev->iwpriv, "iwpriv", iface,
                         "monitor", "1", "1", NULL );
                 exit( 1 );
@@ -994,7 +993,7 @@
         case DT_ACX:
             if( ( pid = fork() ) == 0 )
             {
-                close( 0 ); close( 1 ); close( 2 ); chdir( "/" );
+                close( 0 ); close( 1 ); close( 2 ); unused = chdir( "/" );
                 execlp( dev->iwpriv, "iwpriv", iface,
                         "monitor", "2", "1", NULL );
                 exit( 1 );
@@ -1032,7 +1031,7 @@
 
     if( ! fork() )  /* hostap */
     {
-        close( 0 ); close( 1 ); close( 2 ); chdir( "/" );
+        close( 0 ); close( 1 ); close( 2 ); unused = chdir( "/" );
         execlp( "iwpriv", "iwpriv", iface, "monitor_type", "1", NULL );
         exit( 1 );
     }
@@ -1040,7 +1039,7 @@
 
     if( ! fork() )  /* r8180 */
     {
-        close( 0 ); close( 1 ); close( 2 ); chdir( "/" );
+        close( 0 ); close( 1 ); close( 2 ); unused = chdir( "/" );
         execlp( "iwpriv", "iwpriv", iface, "prismhdr", "1", NULL );
         exit( 1 );
     }
@@ -1048,7 +1047,7 @@
 
     if( ! fork() )  /* prism54 */
     {
-        close( 0 ); close( 1 ); close( 2 ); chdir( "/" );
+        close( 0 ); close( 1 ); close( 2 ); unused = chdir( "/" );
         execlp( "iwpriv", "iwpriv", iface, "set_prismhdr", "1", NULL );
         exit( 1 );
     }
@@ -1261,7 +1260,7 @@
  */
 static int do_linux_open(struct wif *wi, char *iface)
 {
-    int kver;
+    int kver, unused;
     struct utsname checklinuxversion;
     struct priv_linux *dev = wi_priv(wi);
     char *iwpriv;
@@ -1275,6 +1274,7 @@
     FILE *acpi;
     char r_file[128], buf[128];
     struct ifreq ifr;
+    char * unused_str;
 
     dev->inject_wlanng = 1;
     dev->rate = 2; /* default to 1Mbps if nothing is set */
@@ -1422,12 +1422,12 @@
         snprintf( strbuf,  sizeof( strbuf ) - 1,
                   "iwpriv %s rfmontx 1 >/dev/null 2>/dev/null",
                   iface );
-        system( strbuf );
+        unused = system( strbuf );
     }
 
     /* check if newer athXraw interface available */
 
-    if( ( strlen( iface ) == 4 || strlen( iface ) == 5 )
+    if( ( strlen( iface ) >= 4 || strlen( iface ) <= 6 )
         && memcmp( iface, "ath", 3 ) == 0 )
     {
         dev->drivertype = DT_MADWIFI;
@@ -1471,14 +1471,14 @@
                 memset( strbuf, 0, sizeof( strbuf ) );
                 snprintf( strbuf,  sizeof( strbuf ) - 1,
                           "ifconfig %s up", athXraw );
-                system( strbuf );
+                unused = system( strbuf );
 
 #if 0 /* some people reported problems when prismheader is enabled */
                 memset( strbuf, 0, sizeof( strbuf ) );
                 snprintf( strbuf,  sizeof( strbuf ) - 1,
                          "sysctl -w dev.%s.rawdev_type=1 >/dev/null 2>/dev/null",
                          iface );
-                system( strbuf );
+                unused = system( strbuf );
 #endif
 
                 iface = athXraw;
@@ -1492,7 +1492,7 @@
     {
         if( ( pid = fork() ) == 0 )
         {
-            close( 0 ); close( 1 ); close( 2 ); chdir( "/" );
+            close( 0 ); close( 1 ); close( 2 ); unused = chdir( "/" );
             execlp( "iwpriv", "iwpriv", iface, "get_port3", NULL );
             exit( 1 );
         }
@@ -1518,7 +1518,7 @@
     {
         if( ( pid = fork() ) == 0 )
         {
-            close( 0 ); close( 1 ); close( 2 ); chdir( "/" );
+            close( 0 ); close( 1 ); close( 2 ); unused = chdir( "/" );
             execlp( "iwpriv", "iwpriv", iface, "get_regdomain", NULL );
             exit( 1 );
         }
@@ -1536,7 +1536,7 @@
         if ((acpi = fopen(r_file, "r")) == NULL)
             goto close_out;
         memset(buf, 0, 128);
-        fgets(buf, 128, acpi);
+        unused_str = fgets(buf, 128, acpi);
         buf[127]='\x00';
         //rtap iface doesn't exist
         if(strncmp(buf, "-1", 2) == 0)
@@ -1550,7 +1550,7 @@
             fclose(acpi);
             if ((acpi = fopen(r_file, "r")) == NULL)
                 goto close_out;
-            fgets(buf, 128, acpi);
+            unused_str = fgets(buf, 128, acpi);
         }
         fclose(acpi);
 
@@ -1595,7 +1595,7 @@
                     dev->drivertype = DT_IPW2200;
 
                     memset(buf, 0, 128);
-                    fgets(buf, 128, acpi);
+                    unused_str = fgets(buf, 128, acpi);
                     if(n==0) //interface exists
                     {
                         if (strncmp(buf, iface, 5) == 0)
@@ -1624,7 +1624,7 @@
                             fclose(acpi);
                             if ((acpi = fopen(r_file, "r")) == NULL)
                                 continue;
-                            fgets(buf, 128, acpi);
+                            unused_str = fgets(buf, 128, acpi);
                             if (strncmp(buf, iface, 5) == 0)
                             {
                                 if (net_ifaces != NULL)