diff options
author | Guy Harris <guy@alum.mit.edu> | 2019-01-21 20:57:13 -0800 |
---|---|---|
committer | Guy Harris <guy@alum.mit.edu> | 2019-01-22 05:26:19 +0000 |
commit | d3eb10c2c1d8e69d13c82bfcbe5339cbae225370 (patch) | |
tree | 8081ff5e88c9a43a4d8ed15d32809a18e571a9fc /editcap.c | |
parent | 079fbb8b8253cc496096e98e5e1eabdcc3f03e9c (diff) |
Fix error checking for --inject-secrets argument.
If there was no secrets type specified, say so. Otherwise, if the
secrets type wasn't valid, report the correct string as the invalid
secrets type.
Change-Id: I3cd7d419ce3577fc176a256069456c5b49e81608
Reviewed-on: https://code.wireshark.org/review/31667
Petri-Dish: Guy Harris <guy@alum.mit.edu>
Tested-by: Petri Dish Buildbot
Reviewed-by: Guy Harris <guy@alum.mit.edu>
Diffstat (limited to 'editcap.c')
-rw-r--r-- | editcap.c | 14 |
1 files changed, 9 insertions, 5 deletions
@@ -1102,13 +1102,17 @@ main(int argc, char *argv[]) goto clean_exit; } gchar **splitted = g_strsplit(optarg, ",", 2); - if (splitted[0]) { + if (splitted[0] && splitted[0][0] != '\0') { secrets_type_id = lookup_secrets_type(splitted[0]); + if (secrets_type_id == 0) { + fprintf(stderr, "editcap: \"%s\" isn't a valid secrets type\n", splitted[0]); + g_strfreev(splitted); + ret = INVALID_OPTION; + goto clean_exit; + } secrets_filename = splitted[1]; - } - - if (secrets_type_id == 0) { - fprintf(stderr, "editcap: \"%s\" isn't a valid secrets type\n", secrets_filename); + } else { + fprintf(stderr, "editcap: no secrets type was specified for --inject-secrets\n"); g_strfreev(splitted); ret = INVALID_OPTION; goto clean_exit; |