Skip to content

Commit

Permalink
Check for empty source domain names
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
DemiMarie committed Apr 28, 2024
1 parent 71c1ae3 commit ad72712
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions libqrexec/exec.c
Original file line number Diff line number Diff line change
Expand Up @@ -468,6 +468,10 @@ struct qrexec_parsed_command *parse_qubes_rpc_command(

start = end + 1; /* after the space */
end = strchrnul(start, ' ');
if (end <= start) {
LOG(ERROR, "Source domain is empty (too many spaces after service descriptor?)");
goto err;
}
cmd->source_domain = memdupnul(start, (size_t)(end - start));
if (!cmd->source_domain)
goto err;
Expand Down

0 comments on commit ad72712

Please sign in to comment.