]> www.infradead.org Git - users/jedix/linux-maple.git/commitdiff
carl9170: Use scnprintf() for avoiding potential buffer overflow
authorTakashi Iwai <tiwai@suse.de>
Wed, 11 Mar 2020 08:47:09 +0000 (09:47 +0100)
committerKalle Valo <kvalo@codeaurora.org>
Thu, 12 Mar 2020 13:43:36 +0000 (15:43 +0200)
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>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
drivers/net/wireless/ath/carl9170/debug.c

index a9b6dc17e40874eb8a3d2a03807e29d26292dc12..19009aafc4e16466f6025059512f98c1effba3c8 100644 (file)
@@ -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 {