From 31590ad4ecf21fa0e23d1d3834dc5eac990dfd6e Mon Sep 17 00:00:00 2001 From: fps Date: Thu, 9 Jul 2020 06:56:56 +0200 Subject: [PATCH] jack_connect: fix off-by-one error in allocating space for the server name string --- example-clients/connect.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/example-clients/connect.c b/example-clients/connect.c index b302ce67..fc43b5e9 100644 --- a/example-clients/connect.c +++ b/example-clients/connect.c @@ -88,7 +88,7 @@ main (int argc, char *argv[]) while ((c = getopt_long (argc, argv, "s:hvu", long_options, &option_index)) >= 0) { switch (c) { case 's': - server_name = (char *) malloc (sizeof (char) * strlen(optarg)); + server_name = (char *) malloc (sizeof (char) * (strlen(optarg) + 1)); strcpy (server_name, optarg); options |= JackServerName; break;