--- Begin Message ---
Package: amap
Severity: normal
Tags: patch
When building 'amap' on amd64 with gcc-4.0,
I get the following error:
amap.c: In function 'amap_scan':
amap.c:1595: error: invalid lvalue in assignment
amap.c: In function 'main':
amap.c:1847: error: invalid lvalue in assignment
amap.c:1888: error: invalid lvalue in assignment
amap.c:1900: error: invalid lvalue in assignment
amap.c:1915: error: invalid lvalue in assignment
amap.c:1945: error: invalid lvalue in assignment
amap.c:2031: warning: pointer targets in passing argument 1 of
'amap_printable_banner_string' differ in signedness
make[1]: *** [amap] Error 1
make[1]: Leaving directory `/amap-4.7'
make: *** [build-stamp] Error 2
With the attached patch 'amap' can be compiled
on amd64 using gcc-4.0.
Regards
Andreas Jochens
diff -urN ../tmp-orig/amap-4.7/amap.c ./amap.c
--- ../tmp-orig/amap-4.7/amap.c 2004-10-20 10:31:46.000000000 +0200
+++ ./amap.c 2004-12-10 16:37:06.792481168 +0100
@@ -252,7 +252,7 @@
f = amap_open_file(filename, "trigger", extension, opt->verbose);
if (opt->verbose > 1)
printf("\n");
- if (((amap_struct_triggers*) triggers = (amap_struct_triggers*) trigger =
(amap_struct_triggers*) malloc(sizeof(amap_struct_triggers))) == NULL)
+ if ((triggers = trigger = (amap_struct_triggers*)
malloc(sizeof(amap_struct_triggers))) == NULL)
amap_error("malloc failed");
memset(trigger, 0, sizeof(amap_struct_triggers));
@@ -269,7 +269,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 = (amap_struct_triggers*)
malloc(sizeof(amap_struct_triggers))) == NULL)
amap_error("malloc failed");
trigger = (amap_struct_triggers*) trigger->next;
memset(trigger, 0, sizeof(amap_struct_triggers));
@@ -427,7 +427,7 @@
f = amap_open_file(filename, "response", extension, opt->verbose);
if (opt->verbose > 1)
printf("\n");
- if (((amap_struct_responses*) responses = (amap_struct_responses*) response
= (amap_struct_responses*) malloc(sizeof(amap_struct_responses))) == NULL)
+ if ((responses = response = (amap_struct_responses*)
malloc(sizeof(amap_struct_responses))) == NULL)
amap_error("malloc failed");
memset(response, 0, sizeof(amap_struct_responses));
@@ -437,7 +437,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 = (amap_struct_responses*)
malloc(sizeof(amap_struct_responses))) == NULL)
amap_error("malloc failed");
response = (amap_struct_responses*) response->next;
memset(response, 0, sizeof(amap_struct_responses));
@@ -472,7 +472,7 @@
for (i = 0; i < strlen(triggerptr); i++)
if (triggerptr[i] == ',')
count++;
- if (((amap_struct_triggerptr*) triggerptr_tmp = response->triggerptr =
malloc(sizeof(amap_struct_triggerptr))) == NULL)
+ if ((triggerptr_tmp = response->triggerptr =
malloc(sizeof(amap_struct_triggerptr))) == NULL)
amap_error("malloc failed");
triggerptr_tmp->next = NULL;
@@ -484,7 +484,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;
@@ -556,7 +556,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 = (amap_struct_ports *)
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));
@@ -584,7 +584,7 @@
int count = 0;
f = amap_open_file(filename, "nmap", "", opt->verbose);
- if (((amap_struct_targets*) targets = (amap_struct_targets*) target =
(amap_struct_targets*) malloc(sizeof(amap_struct_targets))) == NULL)
+ if ((targets = target = (amap_struct_targets*)
malloc(sizeof(amap_struct_targets))) == NULL)
amap_error("malloc failed");
memset(target, 0, sizeof(amap_struct_targets));
if ((port_tmp = target->ports = (amap_struct_ports *)
malloc(sizeof(amap_struct_ports))) == NULL)
@@ -596,7 +596,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 = (amap_struct_targets*)
malloc(sizeof(amap_struct_targets))) == NULL)
amap_error("malloc failed");
target = (amap_struct_targets*) target->next;
memset(target, 0, sizeof(amap_struct_targets));
@@ -637,7 +637,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 = (amap_struct_ports *)
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));
@@ -852,7 +852,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;
}
@@ -1593,7 +1593,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;
@@ -1845,7 +1845,7 @@
responses_tmp = (amap_struct_responses*) responses_tmp->next;
}
} else {
- if (((amap_struct_triggers*) triggers = (amap_struct_triggers*)
malloc(sizeof(amap_struct_triggers))) == NULL)
+ if (( triggers = (amap_struct_triggers*)
malloc(sizeof(amap_struct_triggers))) == NULL)
amap_error("malloc failed");
triggers->next = NULL;
triggers->id = strdup("NULL");
@@ -1886,7 +1886,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 = (amap_struct_ports *)
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));
@@ -1898,7 +1898,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 = (amap_struct_targets *)
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));
@@ -1913,7 +1913,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 = (amap_struct_ports *)
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));
@@ -1943,7 +1943,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 = (amap_struct_ports *)
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));
--- End Message ---