Bugfix: Correct handling of n in strncat()

This commit is contained in:
Andreas Eversberg
2019-09-28 15:49:04 +02:00
parent 830794bae4
commit 860f91af6f
2 changed files with 3 additions and 3 deletions

View File

@@ -636,7 +636,7 @@ int sdr_start(void *inst)
return rc;
}
pthread_getname_np(tid, tname, sizeof(tname));
strncat(tname, "-sdr_tx", sizeof(tname) - 1);
strncat(tname, "-sdr_tx", sizeof(tname) - 7 - 1);
tname[sizeof(tname) - 1] = '\0';
pthread_setname_np(tid, tname);
sdr->thread_read.running = 1;
@@ -648,7 +648,7 @@ int sdr_start(void *inst)
return rc;
}
pthread_getname_np(tid, tname, sizeof(tname));
strncat(tname, "-sdr_rx", sizeof(tname) - 1);
strncat(tname, "-sdr_rx", sizeof(tname) - 7 - 1);
tname[sizeof(tname) - 1] = '\0';
pthread_setname_np(tid, tname);
}