Commit 9ebc87ac authored by Ben Collins's avatar Ben Collins Committed by Linus Torvalds

[PATCH] Fix snd_seq_queue_find_name()

While going through sound/ for strncpy replacing, I came across this
routine:

/* return the (first) queue matching with the specified name */
queue_t *snd_seq_queue_find_name(char *name)
{
        int i;
        queue_t *q;

        for (i = 0; i < SNDRV_SEQ_MAX_QUEUES; i++) {
                if ((q = queueptr(i)) != NULL) {
                        if (strncpy(q->name, name, sizeof(q->name)) == 0)
                                return q;
                        queuefree(q);
                }
        }
        return NULL;
}


I'm _really_ sure that they meant to use strncmp() here instead.

Like this.
parent d0500d3e
......@@ -241,7 +241,7 @@ queue_t *snd_seq_queue_find_name(char *name)
for (i = 0; i < SNDRV_SEQ_MAX_QUEUES; i++) {
if ((q = queueptr(i)) != NULL) {
if (strncpy(q->name, name, sizeof(q->name)) == 0)
if (strncmp(q->name, name, sizeof(q->name)) == 0)
return q;
queuefree(q);
}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment