diff options
author | paul <paul@0c269be4-1314-0410-8aa9-9f06e86f4224> | 2011-06-08 23:53:06 +0000 |
---|---|---|
committer | paul <paul@0c269be4-1314-0410-8aa9-9f06e86f4224> | 2011-06-08 23:53:06 +0000 |
commit | a67243ec542a1c41fd6cf0baf554b4bd16f86d18 (patch) | |
tree | 8862540bd4b1b4bfc94c60e6a698cf414dc25f69 | |
parent | 070903509d56b3d7685490f59d929f867718d239 (diff) | |
download | jack1-a67243ec542a1c41fd6cf0baf554b4bd16f86d18.tar.gz |
fix array overrun when jack_get_ports() returns the full set of all possible ports
git-svn-id: svn+ssh://jackaudio.org/trunk/jack@4448 0c269be4-1314-0410-8aa9-9f06e86f4224
-rw-r--r-- | libjack/client.c | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/libjack/client.c b/libjack/client.c index 22c003d..110a484 100644 --- a/libjack/client.c +++ b/libjack/client.c @@ -3022,7 +3022,7 @@ jack_get_ports (jack_client_t *client, psp = engine->ports; match_cnt = 0; - if ((matching_ports = (const char **) malloc (sizeof (char *) * engine->port_max)) == NULL) { + if ((matching_ports = (const char **) malloc (sizeof (char *) * (engine->port_max + 1))) == NULL) { return NULL; } @@ -3065,12 +3065,12 @@ jack_get_ports (jack_client_t *client, regfree (&type_regex); } - matching_ports[match_cnt] = 0; - if (match_cnt == 0) { free (matching_ports); matching_ports = 0; - } + } else { + matching_ports[match_cnt] = 0; + } return matching_ports; } |