瀏覽代碼

Set a NUL terminator before calling inet_aton.

tags/v0.9.3
Michael Brown 18 年之前
父節點
當前提交
8a3f4b7de6
共有 1 個文件被更改,包括 3 次插入2 次删除
  1. 3
    2
      src/tests/dhcptest.c

+ 3
- 2
src/tests/dhcptest.c 查看文件

@@ -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 ) {

Loading…
取消
儲存