]> git.ipfire.org Git - thirdparty/hostap.git/commitdiff
hs20-osu-client: Fix pol_upd command line parsing
authorJouni Malinen <jouni@qca.qualcomm.com>
Wed, 16 Mar 2016 19:25:11 +0000 (21:25 +0200)
committerJouni Malinen <j@w1.fi>
Wed, 16 Mar 2016 19:25:11 +0000 (21:25 +0200)
This command was documented as having the Server URL parameter as
optional, but the implementation did not match that. Allow this
parameter to be left out.

Signed-off-by: Jouni Malinen <jouni@qca.qualcomm.com>
hs20/client/osu_client.c

index f79f59bbbb68e7763c5dfacd2f2128d2e6462aab..c05c57d44f896b51267d270ae82f1c1d943f218b 100644 (file)
@@ -2570,7 +2570,7 @@ static int cmd_pol_upd(struct hs20_osu_client *ctx, const char *address,
        if (!pps_fname) {
                char buf[256];
                wpa_printf(MSG_INFO, "Determining PPS file based on Home SP information");
-               if (os_strncmp(address, "fqdn=", 5) == 0) {
+               if (address && os_strncmp(address, "fqdn=", 5) == 0) {
                        wpa_printf(MSG_INFO, "Use requested FQDN from command line");
                        os_snprintf(buf, sizeof(buf), "%s", address + 5);
                        address = NULL;
@@ -3137,11 +3137,8 @@ int main(int argc, char *argv[])
                                  argc > optind + 2 ? argv[optind + 2] : NULL,
                                  argc > optind + 3 ? argv[optind + 3] : NULL);
        } else if (strcmp(argv[optind], "pol_upd") == 0) {
-               if (argc - optind < 2) {
-                       usage();
-                       exit(0);
-               }
-               ret = cmd_pol_upd(&ctx, argc > 2 ? argv[optind + 1] : NULL,
+               ret = cmd_pol_upd(&ctx,
+                                 argc > optind + 1 ? argv[optind + 1] : NULL,
                                  argc > optind + 2 ? argv[optind + 2] : NULL,
                                  argc > optind + 3 ? argv[optind + 3] : NULL);
        } else if (strcmp(argv[optind], "prov") == 0) {