patch "staging: most: use format specifier "%s" in snprintf" added to staging-linus
Subsystems (3)
This is a note to let you know that I've just added the patch titled
staging: most: use format specifier "%s" in snprintf
to my staging git tree which can be found at
git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/staging.git
in the staging-linus branch.
The patch will show up in the next release of the linux-next tree (usually sometime within the next 24 hours during the week.)
The patch will hopefully also be merged in Linus's tree for the next -rc kernel release.
If you have any questions about this process, please let me know.
Quoted 1 line
From
13c45007e0a87e912da21223599583fdea677914Mon Sep 17 00:00:00 2001
From: Colin Ian King <[email protected]>
Date: Fri, 9 Nov 2018 11:56:45 +0000
Subject: staging: most: use format specifier "%s" in snprintf
Passing string ch_data_type[i].name as the format specifier is potentially hazardous because it could (although very unlikely to) have a format specifier embedded in it causing issues when parsing the non-existent arguments to these. Follow best practice by using the "%s" format string for the string.
Cleans up clang warning:
format string is not a string literal (potentially insecure) [-Wformat-security]
--- drivers/staging/most/core.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/staging/most/core.c +1 -1
@@ -351,7 +351,7 @@ static ssize_t set_datatype_show(struct device *dev,for (i =0 ; i <ARRAY_SIZE (ch_data_type); i++) {if (c->cfg.data_type & ch_data_type[i].most_ch_data_type) -return snprintf (buf,PAGE_SIZE , ch_data_type[i].name); +return snprintf (buf,PAGE_SIZE ,"%s" , ch_data_type[i].name); }return snprintf (buf,PAGE_SIZE ,"unconfigured\n" ); }
Signature · 1 line
2.19.1