Skip to content
Permalink
Browse files Browse the repository at this point in the history
dbus: report invalid element names
Return D-Bus error in case of invalid problem element name.

Related: #1214451

Signed-off-by: Jakub Filak <jfilak@redhat.com>
  • Loading branch information
Jakub Filak committed May 4, 2015
1 parent 7814554 commit f3c2a6a
Showing 1 changed file with 13 additions and 1 deletion.
14 changes: 13 additions & 1 deletion src/dbus/abrt-dbus.c
Expand Up @@ -599,7 +599,7 @@ static void handle_method_call(GDBusConnection *connection,

g_variant_get(parameters, "(&s&s&s)", &problem_id, &element, &value);

if (element == NULL || element[0] == '\0' || strlen(element) > 64)
if (!str_is_correct_filename(element))
{
log_notice("'%s' is not a valid element name of '%s'", element, problem_id);
char *error = xasprintf(_("'%s' is not a valid element name"), element);
Expand Down Expand Up @@ -658,6 +658,18 @@ static void handle_method_call(GDBusConnection *connection,

g_variant_get(parameters, "(&s&s)", &problem_id, &element);

if (!str_is_correct_filename(element))
{
log_notice("'%s' is not a valid element name of '%s'", element, problem_id);
char *error = xasprintf(_("'%s' is not a valid element name"), element);
g_dbus_method_invocation_return_dbus_error(invocation,
"org.freedesktop.problems.InvalidElement",
error);

free(error);
return;
}

struct dump_dir *dd = open_directory_for_modification_of_element(
invocation, caller_uid, problem_id, element);
if (!dd)
Expand Down

0 comments on commit f3c2a6a

Please sign in to comment.