public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Ben Collins <bcollins@debian.org>
To: Linus Torvalds <torvalds@transmeta.com>
Cc: linux-kernel@vger.kernel.org
Subject: [PATCH] Fix snd_seq_queue_find_name()
Date: Sun, 25 May 2003 13:34:06 -0400	[thread overview]
Message-ID: <20030525173406.GC602@phunnypharm.org> (raw)

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. Patch
below fixes it.


Index: sound/core/seq/seq_queue.c
===================================================================
--- sound/core/seq/seq_queue.c	(revision 10041)
+++ sound/core/seq/seq_queue.c	(working copy)
@@ -241,7 +241,7 @@
 
 	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);
 		}

                 reply	other threads:[~2003-05-25 18:09 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20030525173406.GC602@phunnypharm.org \
    --to=bcollins@debian.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=torvalds@transmeta.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox