]> git.alsa-project.org Git - alsa-lib.git/commitdiff
seq: Fix for snd_seq_parse_address()
authorPedro Lopez-Cabanillas <pedro.lopez.cabanillas@gmail.com>
Thu, 22 Apr 2010 13:42:20 +0000 (15:42 +0200)
committerJaroslav Kysela <perex@perex.cz>
Thu, 22 Apr 2010 14:08:14 +0000 (16:08 +0200)
snd_seq_parse_address() uses strncmp() to compare the client name
in the string argument with the existing clients, until it finds one
name matching the same leading characters. This may produce wrong
results when there are two sequencer clients with similar names.

Example: "KMidimon" : "Kmid"

Signed-off-by: Pedro Lopez-Cabanillas <pedro.lopez.cabanillas@gmail.com>
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
src/seq/seqmid.c

index 86a497097e7fdde7cf0918335f34d79a702ba5cf..894c3a26bfbd066b54c06d2515af6d03f6f93898 100644 (file)
@@ -414,7 +414,8 @@ int snd_seq_parse_address(snd_seq_t *seq, snd_seq_addr_t *addr, const char *arg)
                        return -EINVAL;
                cinfo.client = -1;
                while (snd_seq_query_next_client(seq, &cinfo) >= 0) {
-                       if (! strncmp(arg, cinfo.name, len)) {
+                       if ((strlen(cinfo.name) == len) &&
+                               ! strncmp(arg, cinfo.name, len)) {
                                addr->client = cinfo.client;
                                return 0;
                        }