Skip to content

Commit ad72712

Browse files
committed
Check for empty source domain names
The source domain can never be the empty string. If it _is_ empty, the most likely cause is a bug in code that is generating the command, such as two or more spaces after the service descriptor. This could result in the parsed source domain being the empty string, while the domain passed to qubes-rpc-multiplexer is not empty. Instead of allowing this tricky-to-debug situation, fail the service call up front.
1 parent 71c1ae3 commit ad72712

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

libqrexec/exec.c

+4
Original file line numberDiff line numberDiff line change
@@ -468,6 +468,10 @@ struct qrexec_parsed_command *parse_qubes_rpc_command(
468468

469469
start = end + 1; /* after the space */
470470
end = strchrnul(start, ' ');
471+
if (end <= start) {
472+
LOG(ERROR, "Source domain is empty (too many spaces after service descriptor?)");
473+
goto err;
474+
}
471475
cmd->source_domain = memdupnul(start, (size_t)(end - start));
472476
if (!cmd->source_domain)
473477
goto err;

0 commit comments

Comments
 (0)