Permalink
Browse files

acpi_result_to_string: Fix possible buffer overflow (by 1)

  • Loading branch information...
1 parent 45f24c0 commit 52993eb5d992a2d627a80fe960a6547564405d42 @Lekensteyn Lekensteyn committed Oct 22, 2011
Showing with 3 additions and 1 deletion.
  1. +3 −1 acpi_call.c
View
@@ -52,7 +52,9 @@ static int acpi_result_to_string(union acpi_object *result) {
sprintf(BUFFER, ",");
not_written++;
} else {
- sprintf(BUFFER, "}");
+ // in case the show_value == 0, but the buffer is too small to hold
+ // more values (i.e. the buffer cannot have anything more than "{")
+ snprintf(BUFFER, BYTES_AVAIL, "}");
}
} else if (result->type == ACPI_TYPE_PACKAGE) {
int i;

0 comments on commit 52993eb

Please sign in to comment.