Browse Source

Set a NUL terminator before calling inet_aton.

tags/v0.9.3
Michael Brown 18 years ago
parent
commit
8a3f4b7de6
1 changed files with 3 additions and 2 deletions
  1. 3
    2
      src/tests/dhcptest.c

+ 3
- 2
src/tests/dhcptest.c View File

25
 	memset ( &target, 0, sizeof ( target ) );
25
 	memset ( &target, 0, sizeof ( target ) );
26
 	target.sin.sin_family = AF_INET;
26
 	target.sin.sin_family = AF_INET;
27
 	target.sin.sin_port = htons ( ISCSI_PORT );
27
 	target.sin.sin_port = htons ( ISCSI_PORT );
28
-	target_iqn = strchr ( iscsiname, ':' ) + 1;
28
+	target_iqn = strchr ( iscsiname, ':' );
29
+	*target_iqn++ = '\0';
29
 	if ( ! target_iqn ) {
30
 	if ( ! target_iqn ) {
30
 		printf ( "Invalid iSCSI DHCP path\n" );
31
 		printf ( "Invalid iSCSI DHCP path\n" );
31
 		return -EINVAL;
32
 		return -EINVAL;
32
 	}
33
 	}
33
 	inet_aton ( iscsiname, &target.sin.sin_addr );
34
 	inet_aton ( iscsiname, &target.sin.sin_addr );
34
 
35
 
35
-	return test_iscsiboot ( initiator_iqn, &target, target_iqn );
36
+	return test_iscsiboot ( initiator_iqn, &target.st, target_iqn );
36
 }
37
 }
37
 
38
 
38
 static int test_dhcp_boot ( struct net_device *netdev, char *filename ) {
39
 static int test_dhcp_boot ( struct net_device *netdev, char *filename ) {

Loading…
Cancel
Save