remote: Minor argument parsing cleanup

Only access relevant portion of argv after we've verified argc.

https://bugzilla.gnome.org/show_bug.cgi?id=731984
This commit is contained in:
Colin Walters 2014-06-21 12:11:56 -04:00
parent 1962623bbc
commit 6eac108560
1 changed files with 3 additions and 1 deletions

View File

@ -98,7 +98,7 @@ ostree_builtin_remote (int argc, char **argv, OstreeRepo *repo, GCancellable *ca
if (!strcmp (op, "add")) if (!strcmp (op, "add"))
{ {
const char *url = argv[3]; const char *url;
char **iter; char **iter;
gs_free char *target_name = NULL; gs_free char *target_name = NULL;
gs_unref_object GFile *target_conf = NULL; gs_unref_object GFile *target_conf = NULL;
@ -110,6 +110,8 @@ ostree_builtin_remote (int argc, char **argv, OstreeRepo *repo, GCancellable *ca
goto out; goto out;
} }
url = argv[3];
optbuilder = g_variant_builder_new (G_VARIANT_TYPE ("a{sv}")); optbuilder = g_variant_builder_new (G_VARIANT_TYPE ("a{sv}"));
if (argc > 4) if (argc > 4)