Fix usage of strncat

This commit is contained in:
Andreas Eversberg
2024-01-04 17:58:05 +01:00
parent 454086f04c
commit 31d5667516
2 changed files with 3 additions and 3 deletions

View File

@@ -467,7 +467,7 @@ static void *device_child(void *arg)
const char *dev_info_argv[] = { dev_name };
struct cuse_info ci;
strncat(dev_name, device->name, sizeof(dev_name) - strlen(device->name) - 1);
strncat(dev_name, device->name, sizeof(dev_name) - strlen(dev_name) - 1);
memset(&ci, 0, sizeof(ci));
ci.dev_major = device->major;
@@ -520,7 +520,7 @@ void *device_init(void *inst, const char *name, int (*open)(void *inst, int flag
}
pthread_getname_np(device->thread, tname, sizeof(tname));
strncat(tname, "-device", sizeof(tname) - 7 - 1);
strncat(tname, "-device", sizeof(tname) - strlen(tname) - 1);
tname[sizeof(tname) - 1] = '\0';
pthread_setname_np(device->thread, tname);