carl9170: Use scnprintf() for avoiding potential buffer overflow

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>
This commit is contained in:
Takashi Iwai 2020-03-11 09:47:09 +01:00 коммит произвёл Kalle Valo
Родитель 32521a9138
Коммит 5cb5b4759c
1 изменённых файлов: 1 добавлений и 1 удалений

Просмотреть файл

@ -45,7 +45,7 @@
#include "cmd.h" #include "cmd.h"
#define ADD(buf, off, max, fmt, args...) \ #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 { struct carl9170_debugfs_fops {