Browse Source

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
tags/0.121.0
paul 14 years ago
parent
commit
a67243ec54
1 changed files with 4 additions and 4 deletions
  1. +4
    -4
      libjack/client.c

+ 4
- 4
libjack/client.c View File

@@ -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;
}


Loading…
Cancel
Save