summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPedro Lopez-Cabanillas <pedro.lopez.cabanillas@gmail.com>2010-04-22 15:42:20 +0200
committerJaroslav Kysela <perex@perex.cz>2010-04-22 16:08:14 +0200
commit19892334499ed21ed4dc30084ad8700253f9cb2f (patch)
tree8f7879b50697082c6a39dc745ffdb41c4695523f
parent8d80d5f344ae5e32d24122cbf8e759fdd1e1a60d (diff)
downloadalsa-lib-19892334499ed21ed4dc30084ad8700253f9cb2f.tar.gz
seq: Fix for snd_seq_parse_address()
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>
-rw-r--r--src/seq/seqmid.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/src/seq/seqmid.c b/src/seq/seqmid.c
index 86a49709..894c3a26 100644
--- a/src/seq/seqmid.c
+++ b/src/seq/seqmid.c
@@ -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;
}