提交 3da6abd4 编写于 作者: B Blue Swirl

Use pstrcpy and pstrcat to avoid OpenBSD linker warning

Signed-off-by: NBlue Swirl <blauwirbel@gmail.com>
上级 97b35e35
...@@ -2504,10 +2504,11 @@ int net_client_init(Monitor *mon, const char *device, const char *p) ...@@ -2504,10 +2504,11 @@ int net_client_init(Monitor *mon, const char *device, const char *p)
goto out; goto out;
} }
if (get_param_value(buf, sizeof(buf), "ip", p)) { if (get_param_value(buf, sizeof(buf), "ip", p)) {
int vnet_buflen = strlen(buf) + strlen("/24") + 1;
/* emulate legacy parameter */ /* emulate legacy parameter */
vnet = qemu_malloc(strlen(buf) + strlen("/24") + 1); vnet = qemu_malloc(vnet_buflen);
strcpy(vnet, buf); pstrcpy(vnet, vnet_buflen, buf);
strcat(vnet, "/24"); pstrcat(vnet, vnet_buflen, "/24");
} }
if (get_param_value(buf, sizeof(buf), "net", p)) { if (get_param_value(buf, sizeof(buf), "net", p)) {
vnet = qemu_strdup(buf); vnet = qemu_strdup(buf);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册