linux-wireless.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Takashi Iwai <tiwai@suse.de>
To: linux-wireless@vger.kernel.org
Cc: Kalle Valo <kvalo@codeaurora.org>,
	Christian Lamparter <chunkeey@googlemail.com>
Subject: [PATCH 3/7] carl9170: Use scnprintf() for avoiding potential buffer overflow
Date: Wed, 11 Mar 2020 09:47:09 +0100	[thread overview]
Message-ID: <20200311084713.18220-4-tiwai@suse.de> (raw)
In-Reply-To: <20200311084713.18220-1-tiwai@suse.de>

Since snprintf() returns the would-be-output size instead of the
actual output size, the succeeding calls may go beyond the given
buffer limit.  Fix it by replacing with scnprintf().

Cc: Christian Lamparter <chunkeey@googlemail.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
---
 drivers/net/wireless/ath/carl9170/debug.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/net/wireless/ath/carl9170/debug.c b/drivers/net/wireless/ath/carl9170/debug.c
index a9b6dc17e408..19009aafc4e1 100644
--- a/drivers/net/wireless/ath/carl9170/debug.c
+++ b/drivers/net/wireless/ath/carl9170/debug.c
@@ -45,7 +45,7 @@
 #include "cmd.h"
 
 #define ADD(buf, off, max, fmt, args...)				\
-	off += snprintf(&buf[off], max - off, fmt, ##args);
+	off += scnprintf(&buf[off], max - off, fmt, ##args);
 
 
 struct carl9170_debugfs_fops {
-- 
2.16.4


  parent reply	other threads:[~2020-03-11  8:47 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-03-11  8:47 [PATCH 0/7] wireless: Use scnprintf() for avoiding potential buffer overflow Takashi Iwai
2020-03-11  8:47 ` [PATCH 1/7] ath11k: " Takashi Iwai
2020-03-12  8:22   ` Kalle Valo
2020-03-11  8:47 ` [PATCH 2/7] ath5k: " Takashi Iwai
2020-03-11  8:47 ` Takashi Iwai [this message]
2020-03-12 13:44   ` [PATCH 3/7] carl9170: " Kalle Valo
2020-03-11  8:47 ` [PATCH 4/7] b43: " Takashi Iwai
2020-03-11  8:47 ` [PATCH 5/7] b43legacy: " Takashi Iwai
2020-03-11  8:47 ` [PATCH 6/7] ipw2x00: " Takashi Iwai
2020-03-11  8:47 ` [PATCH 7/7] prism54: " Takashi Iwai

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=20200311084713.18220-4-tiwai@suse.de \
    --to=tiwai@suse.de \
    --cc=chunkeey@googlemail.com \
    --cc=kvalo@codeaurora.org \
    --cc=linux-wireless@vger.kernel.org \
    /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;
as well as URLs for NNTP newsgroup(s).