summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThomas Brand <tom@trellis.ch>2019-01-26 03:54:00 +0100
committerThomas Brand <tom@trellis.ch>2019-01-26 03:54:00 +0100
commit667e06890ef47a533a616a5f5661a1d2cae5ffdb (patch)
tree3619ba2ce8574c54609b2f77d1a27277335677c0
parentd46970bb796cccc46c2269f04c4999c14626692c (diff)
downloadjack2-667e06890ef47a533a616a5f5661a1d2cae5ffdb.tar.gz
Fix off-by-one NULL termination in array
Note: the client name length test still fails, this is a different issue.
-rw-r--r--tests/test.cpp4
1 files changed, 2 insertions, 2 deletions
diff --git a/tests/test.cpp b/tests/test.cpp
index b355ec64..e7326e9c 100644
--- a/tests/test.cpp
+++ b/tests/test.cpp
@@ -753,7 +753,7 @@ int main (int argc, char *argv[])
client_name3[i] = 'A';
}
// And last one is the terminating '0'
- client_name3[jack_client_name_size()] = 0;
+ client_name3[jack_client_name_size()-1] = 0;
Log("trying to register a new jackd client with maximum possible client name size...\n", client_name3);
client2 = jack_client_open(client_name3, jack_options, &status, server_name);
if (client2 != NULL) {
@@ -944,7 +944,7 @@ int main (int argc, char *argv[])
port_name3[i] = 'A';
}
// And last one is the terminating '0'
- port_name3[short_port_size_max] = 0;
+ port_name3[short_port_size_max-1] = 0;
jack_port_t * test_max_port = jack_port_register(client1, port_name3,
JACK_DEFAULT_AUDIO_TYPE,
JackPortIsOutput, 0);