From ff5128b4f5e8d55e75299ea4a405066240eb4a7c Mon Sep 17 00:00:00 2001 From: Andriy Gapon Date: Thu, 16 Jan 2014 12:53:01 +0000 Subject: [PATCH] 4427 pid provider rejects probes with valid UTF-8 names illumos/illumos-gate@1444d846b126463eb1059a572ff114d51f7562e5 --- uts/common/dtrace/fasttrap.c | 23 ++++++++++------------- 1 file changed, 10 insertions(+), 13 deletions(-) diff --git a/uts/common/dtrace/fasttrap.c b/uts/common/dtrace/fasttrap.c index 8cfe4cd33beb..f486c06b2cef 100644 --- a/uts/common/dtrace/fasttrap.c +++ b/uts/common/dtrace/fasttrap.c @@ -25,7 +25,7 @@ */ /* - * Copyright (c) 2011, Joyent, Inc. All rights reserved. + * Copyright (c) 2013, Joyent, Inc. All rights reserved. */ #include @@ -1936,8 +1936,7 @@ fasttrap_ioctl(dev_t dev, int cmd, intptr_t arg, int md, cred_t *cr, int *rv) fasttrap_probe_spec_t *probe; uint64_t noffs; size_t size; - int ret; - char *c; + int ret, err; if (copyin(&uprobe->ftps_noffs, &noffs, sizeof (uprobe->ftps_noffs))) @@ -1967,18 +1966,16 @@ fasttrap_ioctl(dev_t dev, int cmd, intptr_t arg, int md, cred_t *cr, int *rv) * Verify that the function and module strings contain no * funny characters. */ - for (c = &probe->ftps_func[0]; *c != '\0'; c++) { - if (*c < 0x20 || 0x7f <= *c) { - ret = EINVAL; - goto err; - } + if (u8_validate(probe->ftps_func, strlen(probe->ftps_func), + NULL, U8_VALIDATE_ENTIRE, &err) < 0) { + ret = EINVAL; + goto err; } - for (c = &probe->ftps_mod[0]; *c != '\0'; c++) { - if (*c < 0x20 || 0x7f <= *c) { - ret = EINVAL; - goto err; - } + if (u8_validate(probe->ftps_mod, strlen(probe->ftps_mod), + NULL, U8_VALIDATE_ENTIRE, &err) < 0) { + ret = EINVAL; + goto err; } if (!PRIV_POLICY_CHOICE(cr, PRIV_ALL, B_FALSE)) {