Commit 3da6abd472200bc30b88d5a900ad316d9517d163

Authored by Blue Swirl
1 parent 97b35e35

Use pstrcpy and pstrcat to avoid OpenBSD linker warning

Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
Showing 1 changed file with 4 additions and 3 deletions
... ... @@ -2504,10 +2504,11 @@ int net_client_init(Monitor *mon, const char *device, const char *p)
2504 2504 goto out;
2505 2505 }
2506 2506 if (get_param_value(buf, sizeof(buf), "ip", p)) {
  2507 + int vnet_buflen = strlen(buf) + strlen("/24") + 1;
2507 2508 /* emulate legacy parameter */
2508   - vnet = qemu_malloc(strlen(buf) + strlen("/24") + 1);
2509   - strcpy(vnet, buf);
2510   - strcat(vnet, "/24");
  2509 + vnet = qemu_malloc(vnet_buflen);
  2510 + pstrcpy(vnet, vnet_buflen, buf);
  2511 + pstrcat(vnet, vnet_buflen, "/24");
2511 2512 }
2512 2513 if (get_param_value(buf, sizeof(buf), "net", p)) {
2513 2514 vnet = qemu_strdup(buf);
... ...