summaryrefslogtreecommitdiffstats
path: root/sys/dev/acpi_support
diff options
context:
space:
mode:
authorhselasky <hselasky@FreeBSD.org>2014-10-30 08:04:48 +0000
committerhselasky <hselasky@FreeBSD.org>2014-10-30 08:04:48 +0000
commit1d17f744c7fc351c6163d4e1a9862bef78a632d5 (patch)
treeb10daf90a34256f49336c4827661577d2b1339d3 /sys/dev/acpi_support
parent2b4fb093044897c573e0f1cfe28d235e8c83db08 (diff)
downloadFreeBSD-src-1d17f744c7fc351c6163d4e1a9862bef78a632d5.zip
FreeBSD-src-1d17f744c7fc351c6163d4e1a9862bef78a632d5.tar.gz
MFC r273733, r273740 and r273773:
The SYSCTL data pointers can come from userspace and must not be directly accessed. Although this will work on some platforms, it can throw an exception if the pointer is invalid and then panic the kernel. Add a missing SYSCTL_IN() of "SCTP_BASE_STATS" structure. Sponsored by: Mellanox Technologies
Diffstat (limited to 'sys/dev/acpi_support')
-rw-r--r--sys/dev/acpi_support/acpi_ibm.c10
1 files changed, 6 insertions, 4 deletions
diff --git a/sys/dev/acpi_support/acpi_ibm.c b/sys/dev/acpi_support/acpi_ibm.c
index 3f53c59..52cee09 100644
--- a/sys/dev/acpi_support/acpi_ibm.c
+++ b/sys/dev/acpi_support/acpi_ibm.c
@@ -899,6 +899,7 @@ acpi_ibm_handlerevents_sysctl(SYSCTL_HANDLER_ARGS)
char *cp, *ep;
int l, val;
unsigned int handler_events;
+ char temp[128];
ACPI_FUNCTION_TRACE((char *)(uintptr_t)__func__);
@@ -920,17 +921,18 @@ acpi_ibm_handlerevents_sysctl(SYSCTL_HANDLER_ARGS)
sbuf_trim(&sb);
sbuf_finish(&sb);
-
- /* Copy out the old values to the user. */
- error = SYSCTL_OUT(req, sbuf_data(&sb), sbuf_len(&sb));
+ strlcpy(temp, sbuf_data(&sb), sizeof(temp));
sbuf_delete(&sb);
+ error = sysctl_handle_string(oidp, temp, sizeof(temp), req);
+
+ /* Check for error or no change */
if (error != 0 || req->newptr == NULL)
goto out;
/* If the user is setting a string, parse it. */
handler_events = 0;
- cp = (char *)req->newptr;
+ cp = temp;
while (*cp) {
if (isspace(*cp)) {
cp++;
OpenPOWER on IntegriCloud