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>, b43-dev@lists.infradead.org
Subject: [PATCH 4/7] b43: Use scnprintf() for avoiding potential buffer overflow
Date: Wed, 11 Mar 2020 09:47:10 +0100	[thread overview]
Message-ID: <20200311084713.18220-5-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: b43-dev@lists.infradead.org
Signed-off-by: Takashi Iwai <tiwai@suse.de>
---
 drivers/net/wireless/broadcom/b43/debugfs.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/net/wireless/broadcom/b43/debugfs.c b/drivers/net/wireless/broadcom/b43/debugfs.c
index 1325727a74ed..dc1819ca52ac 100644
--- a/drivers/net/wireless/broadcom/b43/debugfs.c
+++ b/drivers/net/wireless/broadcom/b43/debugfs.c
@@ -51,7 +51,7 @@ struct b43_dfs_file *fops_to_dfs_file(struct b43_wldev *dev,
 #define fappend(fmt, x...)	\
 	do {							\
 		if (bufsize - count)				\
-			count += snprintf(buf + count,		\
+			count += scnprintf(buf + count,		\
 					  bufsize - count,	\
 					  fmt , ##x);		\
 		else						\
-- 
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 ` [PATCH 3/7] carl9170: " Takashi Iwai
2020-03-12 13:44   ` Kalle Valo
2020-03-11  8:47 ` Takashi Iwai [this message]
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-5-tiwai@suse.de \
    --to=tiwai@suse.de \
    --cc=b43-dev@lists.infradead.org \
    --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).