diff options
author | Can Erkin Acar <canacar@cvs.openbsd.org> | 2006-05-31 03:25:30 +0000 |
---|---|---|
committer | Can Erkin Acar <canacar@cvs.openbsd.org> | 2006-05-31 03:25:30 +0000 |
commit | 8b9913edc5a562e14b40925527dab961879475d7 (patch) | |
tree | 7199b286fe30b2eb0fc6ac3641cd0fcf2f3a2372 /sys/dev/acpi | |
parent | 9940325c753aca4b90c16c11d2d0a7fe581e4437 (diff) |
When allocating a buffer, use the supplied length if the requested
length is smaller. Tested by joris@, ok gwk@
Diffstat (limited to 'sys/dev/acpi')
-rw-r--r-- | sys/dev/acpi/dsdt.c | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/sys/dev/acpi/dsdt.c b/sys/dev/acpi/dsdt.c index 1d34290beef..4d5a361b0be 100644 --- a/sys/dev/acpi/dsdt.c +++ b/sys/dev/acpi/dsdt.c @@ -1,4 +1,4 @@ -/* $OpenBSD: dsdt.c,v 1.44 2006/05/29 21:27:59 canacar Exp $ */ +/* $OpenBSD: dsdt.c,v 1.45 2006/05/31 03:25:29 canacar Exp $ */ /* * Copyright (c) 2005 Jordan Hargrave <jordan@openbsd.org> * @@ -2336,11 +2336,12 @@ aml_eparseval(struct acpi_context *ctx, int deref) end = aml_eparselen(ctx); i2 = aml_eparseint(ctx, AML_ANYINT); // requested length i1 = end - ctx->pos; // supplied length - + dnprintf(40, "buffer: %lld of %lld\n", i1, i2); + if (i2 < i1) + i2 = i1; rv = aml_allocvalue(AML_OBJTYPE_BUFFER, i2, NULL); if (i1 > 0) memcpy(rv->v_buffer, ctx->pos, i1); - dnprintf(40, "buffer: %lld of %lld\n", i1, i2); break; case AMLOP_PACKAGE: case AMLOP_VARPACKAGE: |