diff mbox

wmi: Fix an error on processing the _WDG data

Message ID 1334909102-12784-1-git-send-email-kengyu@canonical.com
State Accepted
Headers show

Commit Message

Keng-Yu Lin April 20, 2012, 8:05 a.m. UTC
On processing the final element (the 8-th) of the raw _WDG data,
the pointer is not incremented. This causes the loss of the final
element and incorrect parsing result.

Signed-off-by: Keng-Yu Lin <kengyu@canonical.com>
---
 src/acpi/wmi/wmi.c |    5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

Comments

Colin Ian King April 20, 2012, 8:16 a.m. UTC | #1
On 20/04/12 09:05, Keng-Yu Lin wrote:
> On processing the final element (the 8-th) of the raw _WDG data,
> the pointer is not incremented. This causes the loss of the final
> element and incorrect parsing result.
>
> Signed-off-by: Keng-Yu Lin<kengyu@canonical.com>
> ---
>   src/acpi/wmi/wmi.c |    5 ++++-
>   1 file changed, 4 insertions(+), 1 deletion(-)
>
> diff --git a/src/acpi/wmi/wmi.c b/src/acpi/wmi/wmi.c
> index de353c6..5a188eb 100644
> --- a/src/acpi/wmi/wmi.c
> +++ b/src/acpi/wmi/wmi.c
> @@ -219,7 +219,10 @@ static void wmi_get_wdg_data(fwts_framework *fw,
>   			str+=4;
>   			if (*str != ',') break;
>   			str++;
> -			if (!isspace(*str)) break;
> +			if (!isspace(*str)) {
> +				data++;
> +				break;
> +			}
>   			str++;
>   			data++;
>   			if (data>  wdg_data + size) {
Well spotted.  Thanks!

Acked-by: Colin Ian King <colin.king@canonical.com>
Alex Hung April 20, 2012, 8:27 a.m. UTC | #2
On 04/20/2012 04:05 PM, Keng-Yu Lin wrote:
> On processing the final element (the 8-th) of the raw _WDG data,
> the pointer is not incremented. This causes the loss of the final
> element and incorrect parsing result.
>
> Signed-off-by: Keng-Yu Lin<kengyu@canonical.com>
> ---
>   src/acpi/wmi/wmi.c |    5 ++++-
>   1 file changed, 4 insertions(+), 1 deletion(-)
>
> diff --git a/src/acpi/wmi/wmi.c b/src/acpi/wmi/wmi.c
> index de353c6..5a188eb 100644
> --- a/src/acpi/wmi/wmi.c
> +++ b/src/acpi/wmi/wmi.c
> @@ -219,7 +219,10 @@ static void wmi_get_wdg_data(fwts_framework *fw,
>   			str+=4;
>   			if (*str != ',') break;
>   			str++;
> -			if (!isspace(*str)) break;
> +			if (!isspace(*str)) {
> +				data++;
> +				break;
> +			}
>   			str++;
>   			data++;
>   			if (data>  wdg_data + size) {

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 de353c6..5a188eb 100644
--- a/src/acpi/wmi/wmi.c
+++ b/src/acpi/wmi/wmi.c
@@ -219,7 +219,10 @@  static void wmi_get_wdg_data(fwts_framework *fw,
 			str+=4;
 			if (*str != ',') break;
 			str++;
-			if (!isspace(*str)) break;
+			if (!isspace(*str)) {
+				data++;
+				break;
+			}
 			str++;
 			data++;
 			if (data > wdg_data + size) {