aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorAndreas Eversberg <jolly@eversberg.eu>2019-09-28 15:49:04 +0200
committerAndreas Eversberg <jolly@eversberg.eu>2019-11-29 15:58:32 +0100
commit860f91af6f0f1ad5598f0009cdab08a8286511c8 (patch)
treef9ecd68a3ec75eda73df4a16f2e006414a27ff45 /src
parent830794bae4aa5ece6c91ba33bad192076ada5ca5 (diff)
Bugfix: Correct handling of n in strncat()
Diffstat (limited to 'src')
-rw-r--r--src/jolly/dsp.c2
-rw-r--r--src/libsdr/sdr.c4
2 files changed, 3 insertions, 3 deletions
diff --git a/src/jolly/dsp.c b/src/jolly/dsp.c
index b9f39bb..94231fd 100644
--- a/src/jolly/dsp.c
+++ b/src/jolly/dsp.c
@@ -144,7 +144,7 @@ void set_speech_string(jolly_t *jolly, char announcement, const char *number)
{
jolly->speech_string[0] = announcement;
jolly->speech_string[1] = '\0';
- strncat(jolly->speech_string, number, sizeof(jolly->speech_string) - 1);
+ strncat(jolly->speech_string, number, sizeof(jolly->speech_string) - strlen(number) - 1);
jolly->speech_digit = 0;
jolly->speech_pos = 0;
}
diff --git a/src/libsdr/sdr.c b/src/libsdr/sdr.c
index 8cd6328..2270d8a 100644
--- a/src/libsdr/sdr.c
+++ b/src/libsdr/sdr.c
@@ -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);
}