diff mbox

[3/3] acpi: wmi: use snprintf to be safe

Message ID 1330679404-8789-4-git-send-email-colin.king@canonical.com
State Accepted
Headers show

Commit Message

Colin Ian King March 2, 2012, 9:10 a.m. UTC
From: Colin Ian King <colin.king@canonical.com>

Signed-off-by: Colin Ian King <colin.king@canonical.com>
---
 src/acpi/wmi/wmi.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

Comments

Keng-Yu Lin March 5, 2012, 7:54 a.m. UTC | #1
On Fri, Mar 2, 2012 at 5:10 PM, Colin King <colin.king@canonical.com> wrote:
> From: Colin Ian King <colin.king@canonical.com>
>
> Signed-off-by: Colin Ian King <colin.king@canonical.com>
> ---
>  src/acpi/wmi/wmi.c |    2 +-
>  1 files changed, 1 insertions(+), 1 deletions(-)
>
> diff --git a/src/acpi/wmi/wmi.c b/src/acpi/wmi/wmi.c
> index 8190e17..de353c6 100644
> --- a/src/acpi/wmi/wmi.c
> +++ b/src/acpi/wmi/wmi.c
> @@ -348,7 +348,7 @@ static int wmi_SSDT(fwts_framework *fw)
>
>        for (i=0; i < 16; i++) {
>                char buffer[10];
> -               sprintf(buffer,"SSDT%d", i+1);
> +               snprintf(buffer, sizeof(buffer), "SSDT%d", i+1);
>
>                ret = wmi_table(fw, "SSDT", i, buffer, &result);
>                if (ret == FWTS_NO_TABLE) {
> --
> 1.7.9
>
Acked-by: Keng-Yu Lin <kengyu@canonical.com>
Alex Hung March 8, 2012, 9:48 a.m. UTC | #2
On 03/02/2012 05:10 PM, Colin King wrote:
> From: Colin Ian King<colin.king@canonical.com>
>
> Signed-off-by: Colin Ian King<colin.king@canonical.com>
> ---
>   src/acpi/wmi/wmi.c |    2 +-
>   1 files changed, 1 insertions(+), 1 deletions(-)
>
> diff --git a/src/acpi/wmi/wmi.c b/src/acpi/wmi/wmi.c
> index 8190e17..de353c6 100644
> --- a/src/acpi/wmi/wmi.c
> +++ b/src/acpi/wmi/wmi.c
> @@ -348,7 +348,7 @@ static int wmi_SSDT(fwts_framework *fw)
>
>   	for (i=0; i<  16; i++) {
>   		char buffer[10];
> -		sprintf(buffer,"SSDT%d", i+1);
> +		snprintf(buffer, sizeof(buffer), "SSDT%d", i+1);
>
>   		ret = wmi_table(fw, "SSDT", i, buffer,&result);
>   		if (ret == FWTS_NO_TABLE) {
Acked-by: Alex Hung <alex.hung@canonical.com>
diff mbox

Patch

diff --git a/src/acpi/wmi/wmi.c b/src/acpi/wmi/wmi.c
index 8190e17..de353c6 100644
--- a/src/acpi/wmi/wmi.c
+++ b/src/acpi/wmi/wmi.c
@@ -348,7 +348,7 @@  static int wmi_SSDT(fwts_framework *fw)
 
 	for (i=0; i < 16; i++) {
 		char buffer[10];
-		sprintf(buffer,"SSDT%d", i+1);
+		snprintf(buffer, sizeof(buffer), "SSDT%d", i+1);
 
 		ret = wmi_table(fw, "SSDT", i, buffer, &result);
 		if (ret == FWTS_NO_TABLE) {