fixed possible segfault in snd_seq_parse_address

This commit is contained in:
Takashi Iwai 2001-09-19 20:10:32 +00:00
parent 2c6ae59504
commit 10fa12eb7d

View file

@ -383,12 +383,11 @@ int snd_seq_parse_address(snd_seq_t *seq, snd_seq_addr_t *addr, const char *arg)
if (! seq)
return -EINVAL;
*p = 0;
if (len <= 0)
return -EINVAL;
cinfo.client = -1;
while (snd_seq_query_next_client(seq, &cinfo) >= 0) {
if (! strncmp(cinfo.name, arg, len)) {
if (! strncmp(arg, cinfo.name, len)) {
addr->client = cinfo.client;
return 0;
}