diff options
author | Michael Sweet <michael.r.sweet@gmail.com> | 2017-10-23 16:23:43 -0400 |
---|---|---|
committer | Michael Sweet <michael.r.sweet@gmail.com> | 2017-10-23 16:23:43 -0400 |
commit | 49fa4983f25b64ec29d548ffa3b9782426007df3 (patch) | |
tree | 3217faf5f7e8d6ec604ed77fc2ab589e31b8d05a /scheduler | |
parent | 34be0e8038da86a2940ca8cb14b475a14598a7f3 (diff) |
DBUS notifications could crash the scheduler (Issue #5143)
- scheduler/ipp.c: Make sure requesting-user-name string is valid UTF-8.
Diffstat (limited to 'scheduler')
-rw-r--r-- | scheduler/ipp.c | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/scheduler/ipp.c b/scheduler/ipp.c index e6743cdcb..5cf980ab3 100644 --- a/scheduler/ipp.c +++ b/scheduler/ipp.c @@ -1597,6 +1597,16 @@ add_job(cupsd_client_t *con, /* I - Client connection */ return (NULL); } + attr = ippFindAttribute(con->request, "requesting-user-name", IPP_TAG_NAME); + + if (attr && !ippValidateAttribute(attr)) + { + send_ipp_status(con, IPP_ATTRIBUTES, _("Bad requesting-user-name value: %s"), cupsLastErrorString()); + if ((attr = ippCopyAttribute(con->response, attr, 0)) != NULL) + attr->group_tag = IPP_TAG_UNSUPPORTED_GROUP; + return (NULL); + } + if ((job = cupsdAddJob(priority, printer->name)) == NULL) { send_ipp_status(con, IPP_INTERNAL_ERROR, @@ -1615,8 +1625,6 @@ add_job(cupsd_client_t *con, /* I - Client connection */ add_job_uuid(job); apply_printer_defaults(printer, job); - attr = ippFindAttribute(job->attrs, "requesting-user-name", IPP_TAG_NAME); - if (con->username[0]) { cupsdSetString(&job->username, con->username); |