summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAdam Miartus <external.adam.miartus@de.bosch.com>2020-01-22 19:29:22 +0100
committerFilipe Coelho <falktx@falktx.com>2020-06-10 22:38:05 +0200
commitaf5cf146891c1db33351f7d8f14ccbaa6ac855dd (patch)
tree6e11d9a58203ec9f2f69171ed7fcfaadd61c1f7c
parent4d251434e88682cd9a19201612d4b27ec9596388 (diff)
downloadjack2-af5cf146891c1db33351f7d8f14ccbaa6ac855dd.tar.gz
jack common: ensure null termination of char arrays
Signed-off-by: Adam Miartus <amiartus@de.adit-jv.com> (cherry picked from commit 733c147c23dc90a8330521c49e5fd76340bcb381) Signed-off-by: Timo Wischer <twischer@de.adit-jv.com> Change-Id: I63a7330408d75f21e25426e42260133669a0db0e (cherry picked from commit 41b58edf09236db477bc1d56308a2b6e71515963) Signed-off-by: Timo Wischer <twischer@de.adit-jv.com>
-rw-r--r--common/JackEngineControl.h1
-rw-r--r--common/JackInternalClient.cpp1
-rw-r--r--common/JackLibClient.cpp1
3 files changed, 3 insertions, 0 deletions
diff --git a/common/JackEngineControl.h b/common/JackEngineControl.h
index 21ae3599..8626a161 100644
--- a/common/JackEngineControl.h
+++ b/common/JackEngineControl.h
@@ -118,6 +118,7 @@ struct SERVER_EXPORT JackEngineControl : public JackShmMem
fMaxUsecs = 0;
ResetRollingUsecs();
strncpy(fServerName, server_name, sizeof(fServerName));
+ fServerName[sizeof(fServerName) - 1] = 0;
fCPULoad = 0.f;
fPeriod = 0;
fComputation = 0;
diff --git a/common/JackInternalClient.cpp b/common/JackInternalClient.cpp
index 2d34e0a4..f653acbe 100644
--- a/common/JackInternalClient.cpp
+++ b/common/JackInternalClient.cpp
@@ -77,6 +77,7 @@ int JackInternalClient::Open(const char* server_name, const char* name, jack_uui
}
strncpy(fServerName, server_name, sizeof(fServerName));
+ fServerName[sizeof(fServerName) - 1] = 0;
// Open server/client direct channel
char name_res[JACK_CLIENT_NAME_SIZE + 1];
diff --git a/common/JackLibClient.cpp b/common/JackLibClient.cpp
index 65e70a13..2e772977 100644
--- a/common/JackLibClient.cpp
+++ b/common/JackLibClient.cpp
@@ -106,6 +106,7 @@ int JackLibClient::Open(const char* server_name, const char* name, jack_uuid_t u
}
strncpy(fServerName, server_name, sizeof(fServerName));
+ fServerName[sizeof(fServerName) - 1] = 0;
// Open server/client channel
char name_res[JACK_CLIENT_NAME_SIZE+1];