summaryrefslogtreecommitdiffstats
path: root/sys/dev/acpica/acpi_cmbat.c
diff options
context:
space:
mode:
authorjhb <jhb@FreeBSD.org>2001-02-26 20:32:18 +0000
committerjhb <jhb@FreeBSD.org>2001-02-26 20:32:18 +0000
commit91c34bffe746c6d5b4c5d24b948402a56625d87d (patch)
tree87b66d6d1dd50ff26570dd579296e27a64bc9d05 /sys/dev/acpica/acpi_cmbat.c
parentbe8339b765b77b578b292a469cb0ddd001b5f534 (diff)
downloadFreeBSD-src-91c34bffe746c6d5b4c5d24b948402a56625d87d.zip
FreeBSD-src-91c34bffe746c6d5b4c5d24b948402a56625d87d.tar.gz
When ensuring the destination buffer is truncated for a string obtained
from a BIF, use the size of the destinatino buffer, not the length of the string to determine where to put the nul char. As a side effect, the old code would truncate the string by one character while it was possibly overflowing the buffer.
Diffstat (limited to 'sys/dev/acpica/acpi_cmbat.c')
-rw-r--r--sys/dev/acpica/acpi_cmbat.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/sys/dev/acpica/acpi_cmbat.c b/sys/dev/acpica/acpi_cmbat.c
index a0c0feb..4c26305 100644
--- a/sys/dev/acpica/acpi_cmbat.c
+++ b/sys/dev/acpica/acpi_cmbat.c
@@ -93,7 +93,7 @@ static int acpi_cmbat_units = 0;
default: \
goto label; \
} \
- dest[length-1] = '\0'; \
+ dest[sizeof(dest)-1] = '\0'; \
} while(0)
static void
OpenPOWER on IntegriCloud