From 21a053f0b004eef4c8beb4b36ed13a55c9ee1e28 Mon Sep 17 00:00:00 2001 From: Pavel Březina Date: Fri, 10 Feb 2012 17:30:37 +0100 Subject: SUDO responder: check if the input is a UTF-8 string https://fedorahosted.org/sssd/ticket/1171 --- src/responder/sudo/sudosrv_cmd.c | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'src/responder/sudo/sudosrv_cmd.c') diff --git a/src/responder/sudo/sudosrv_cmd.c b/src/responder/sudo/sudosrv_cmd.c index f179b9233..52023bec3 100644 --- a/src/responder/sudo/sudosrv_cmd.c +++ b/src/responder/sudo/sudosrv_cmd.c @@ -194,6 +194,13 @@ static int sudosrv_cmd_get_sudorules(struct cli_ctx *cli_ctx) goto done; } + /* If the body isn't valid UTF-8, fail */ + if (!sss_utf8_check(query_body, query_len - 1)) { + DEBUG(SSSDBG_CRIT_FAILURE, ("Supplied data is not valid UTF-8 string\n")); + ret = EINVAL; + goto done; + } + /* parse query */ rawname = sudosrv_get_sudorules_parse_query(cmd_ctx, (const char*)query_body, -- cgit