Bläddra i källkod

Set a NUL terminator before calling inet_aton.

tags/v0.9.3
Michael Brown 18 år sedan
förälder
incheckning
8a3f4b7de6
1 ändrade filer med 3 tillägg och 2 borttagningar
  1. 3
    2
      src/tests/dhcptest.c

+ 3
- 2
src/tests/dhcptest.c Visa fil

@@ -25,14 +25,15 @@ static int test_dhcp_iscsi_boot ( struct net_device *netdev __unused,
25 25
 	memset ( &target, 0, sizeof ( target ) );
26 26
 	target.sin.sin_family = AF_INET;
27 27
 	target.sin.sin_port = htons ( ISCSI_PORT );
28
-	target_iqn = strchr ( iscsiname, ':' ) + 1;
28
+	target_iqn = strchr ( iscsiname, ':' );
29
+	*target_iqn++ = '\0';
29 30
 	if ( ! target_iqn ) {
30 31
 		printf ( "Invalid iSCSI DHCP path\n" );
31 32
 		return -EINVAL;
32 33
 	}
33 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 39
 static int test_dhcp_boot ( struct net_device *netdev, char *filename ) {

Laddar…
Avbryt
Spara