summaryrefslogtreecommitdiff
blob: a22afecda61e30ea939d349e0a7702a42119ac17 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
diff --exclude='*~' -urN amap-4.8.orig/amap.c amap-4.8/amap.c
--- amap-4.8.orig/amap.c	2005-02-21 21:55:38.616979896 -0500
+++ amap-4.8/amap.c	2005-02-21 22:27:37.473269400 -0500
@@ -352,8 +352,8 @@
 
 
 // AMAP_MEMDUP //
-char *amap_memdup(char *string, int len) {
-  char *ptr;
+void *amap_memdup(char *string, int len) {
+  void *ptr;
 
   if (string == NULL)
     return NULL;
@@ -441,7 +441,7 @@
     if ((line[0] != '#') && (index(line, ':') != NULL) && (only_trigger == NULL || strncmp(only_trigger, line, strlen(only_trigger)) == 0)) { // weed out comment lines
       count_triggers++;
       if (count_triggers > 1) {
-        if (((amap_struct_triggers*) trigger->next = (amap_struct_triggers*) malloc(sizeof(amap_struct_triggers))) == NULL)
+        if ((trigger->next = malloc(sizeof(amap_struct_triggers))) == NULL)
           amap_error("malloc failed");
         trigger = (amap_struct_triggers*) trigger->next;
         memset(trigger, 0, sizeof(amap_struct_triggers));
@@ -609,7 +609,7 @@
     if ((line[0] != '#') && (index(line, ':') != NULL)) { // weed out comment lines
       count_responses++;
       if (count_responses > 1) {
-        if (((amap_struct_responses*) response->next = (amap_struct_responses*) malloc(sizeof(amap_struct_responses))) == NULL)
+        if ((response->next = malloc(sizeof(amap_struct_responses))) == NULL)
           amap_error("malloc failed");
         response = (amap_struct_responses*) response->next;
         memset(response, 0, sizeof(amap_struct_responses));
@@ -656,7 +656,7 @@
           triggerptr_tmp->trigger = strdup(triggerptr);
           if (i + 1 < count) {
             triggerptr = ptr;
-            if (((amap_struct_triggerptr*) triggerptr_tmp->next = malloc(sizeof(amap_struct_triggerptr))) == NULL)
+            if ((triggerptr_tmp->next = malloc(sizeof(amap_struct_triggerptr))) == NULL)
               amap_error("malloc failed");
             triggerptr_tmp = (amap_struct_triggerptr*) triggerptr_tmp->next;
             triggerptr_tmp->next = NULL;
@@ -728,7 +728,7 @@
       if (opt->verbose > 1)
         printf("%d/%s ", port_tmp->port, port_tmp->ip_prot == AMAP_PROTO_TCP ? "tcp" : "udp");
       if (pto != pfrom) {
-        if (((amap_struct_ports *) port_tmp->next = (amap_struct_ports *) malloc(sizeof(amap_struct_ports))) == NULL)
+        if ((port_tmp->next = malloc(sizeof(amap_struct_ports))) == NULL)
           amap_error("malloc failed");
         port_tmp = (amap_struct_ports *) port_tmp->next;
         memset(port_tmp, 0, sizeof(amap_struct_ports));
@@ -768,7 +768,7 @@
       amap_error("line in nmap file is too long or not terminating with \\n: %s", line);
     if ((line[0] == 'H') && (index(line, ' ') != NULL) && ((portinfo = strstr(line, "/open/")) != NULL)) { // just care for data lines
       if (count != 0) {
-        if (((amap_struct_targets*) target->next = (amap_struct_targets*) malloc(sizeof(amap_struct_targets))) == NULL)
+        if ((target->next = malloc(sizeof(amap_struct_targets))) == NULL)
           amap_error("malloc failed");
         target = (amap_struct_targets*) target->next;
         memset(target, 0, sizeof(amap_struct_targets));
@@ -809,7 +809,7 @@
       if (opt->verbose > 1)
         printf("%d/%s ", port_tmp->port, port_tmp->ip_prot == AMAP_PROTO_TCP ? "tcp" : "udp");
       while ((portinfo = strstr(proto + 1, "/open/")) != NULL) {
-        if (((amap_struct_ports *) port_tmp->next = (amap_struct_ports *) malloc(sizeof(amap_struct_ports))) == NULL)
+        if ((port_tmp->next = malloc(sizeof(amap_struct_ports))) == NULL)
           amap_error("malloc failed");
         port_tmp = (amap_struct_ports *) port_tmp->next;
         memset(port_tmp, 0, sizeof(amap_struct_ports));
@@ -1024,7 +1024,7 @@
   } else {
     while (ids->next != NULL)
       ids = (amap_struct_identifications*) ids->next;
-    if (((char *) ids->next = malloc(sizeof(amap_struct_identifications))) == NULL)
+    if ((ids->next = malloc(sizeof(amap_struct_identifications))) == NULL)
       amap_error("malloc failed");
     ids = (amap_struct_identifications*) ids->next;
   }
@@ -1765,7 +1765,7 @@
                   fcntl(s, F_SETFL, O_NONBLOCK);
                   coms[i].timer = time(NULL);
                   coms[i].socket = s;
-                  (char*) coms[i].sockaddr = amap_memdup((char *) &target_in, sizeof(target_in));
+                  coms[i].sockaddr = amap_memdup((char *) &target_in, sizeof(target_in));
                   coms[i].sockaddr_len = sizeof(target_in);
                   scaninfo.running++;
                   errno = 0;
@@ -2098,7 +2098,7 @@
       port_tmp = amap_add_port_string(port_tmp, argv[optind + 1], cmd_proto, &opt);
       i = optind + 2;
       while (i < argc) {
-        if (((amap_struct_ports *) port_tmp->next = (amap_struct_ports *) malloc(sizeof(amap_struct_ports))) == NULL)
+        if ((port_tmp->next = malloc(sizeof(amap_struct_ports))) == NULL)
           amap_error("malloc failed");
         port_tmp = (amap_struct_ports *) port_tmp->next;
         memset(port_tmp, 0, sizeof(amap_struct_ports));
@@ -2110,7 +2110,7 @@
       while (strcmp(target_tmp->target, argv[optind]) != 0 && target_tmp->next != NULL)
         target_tmp = (amap_struct_targets *) target_tmp->next;
       if (strcmp(target_tmp->target, argv[optind]) != 0) { // it is not
-        if (((amap_struct_targets *) target_tmp->next = (amap_struct_targets *) malloc(sizeof(amap_struct_targets))) == NULL)
+        if ((target_tmp->next = malloc(sizeof(amap_struct_targets))) == NULL)
           amap_error("malloc failed");
         target_tmp = (amap_struct_targets *) target_tmp->next;
         memset(target_tmp, 0, sizeof(amap_struct_targets));
@@ -2125,7 +2125,7 @@
           printf("%d/%s ", port_tmp->port, port_tmp->ip_prot == AMAP_PROTO_TCP ? "tcp" : "udp");
         i = optind + 2;
         while (i < argc) {
-          if (((amap_struct_ports *) port_tmp->next = (amap_struct_ports *) malloc(sizeof(amap_struct_ports))) == NULL)
+          if ((port_tmp->next = malloc(sizeof(amap_struct_ports))) == NULL)
             amap_error("malloc failed");
           port_tmp = (amap_struct_ports *) port_tmp->next;
           memset(port_tmp, 0, sizeof(amap_struct_ports));
@@ -2155,7 +2155,7 @@
             while (((port_tmp->ip_prot != cmd_proto) || (port_tmp->port != (unsigned short int) pfrom)) && port_tmp->next != NULL)
               port_tmp = (amap_struct_ports *) port_tmp->next;
             if (port_tmp->port != (unsigned short int) pfrom) { // we have to add the port
-              if (((amap_struct_ports *) port_tmp->next = (amap_struct_ports *) malloc(sizeof(amap_struct_ports))) == NULL)
+              if ((port_tmp->next = malloc(sizeof(amap_struct_ports))) == NULL)
                 amap_error("malloc failed");
               port_tmp = (amap_struct_ports *) port_tmp->next;
               memset(port_tmp, 0, sizeof(amap_struct_ports));
Files amap-4.8.orig/.amap.c.swp and amap-4.8/.amap.c.swp differ
Files amap-4.8.orig/.amap.h.swp and amap-4.8/.amap.h.swp differ