diff options
author | Guy Harris <guy@alum.mit.edu> | 2017-04-14 12:34:18 -0700 |
---|---|---|
committer | Guy Harris <guy@alum.mit.edu> | 2017-04-14 19:34:54 +0000 |
commit | c398858205724434bfcbec0ffed1f4223c2c85d1 (patch) | |
tree | 4817bf8a9ac9b3d626e7c41253e71fd4d24949b2 /epan/prefs.c | |
parent | 74784bdb3ef60d02f6041f6ec6c3b56e3841a2db (diff) |
Give a better error message for invalid characters in preference module names.
And make the message for an invalid character in a preference name more
like it, by putting the offending name in quotes.
Change-Id: I40db8b87eae5e46a1d49213a9a45861b6b3565af
Reviewed-on: https://code.wireshark.org/review/21092
Reviewed-by: Guy Harris <guy@alum.mit.edu>
Diffstat (limited to 'epan/prefs.c')
-rw-r--r-- | epan/prefs.c | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/epan/prefs.c b/epan/prefs.c index 293e8e1dbb..af8492b8e9 100644 --- a/epan/prefs.c +++ b/epan/prefs.c @@ -517,9 +517,11 @@ prefs_register_module_or_subtree(module_t *parent, const char *name, * on the command line, and shouldn't require quoting, * shifting, etc. */ - for (p = name; (c = *p) != '\0'; p++) - g_assert(g_ascii_islower(c) || g_ascii_isdigit(c) || c == '_' || - c == '-' || c == '.'); + for (p = name; (c = *p) != '\0'; p++) { + if (!(g_ascii_islower(c) || g_ascii_isdigit(c) || c == '_' || + c == '-' || c == '.')) + g_error("Preference module \"%s\" contains invalid characters", name); + } /* * Make sure there's not already a module with that @@ -916,7 +918,7 @@ register_preference(module_t *module, const char *name, const char *title, */ for (p = name; *p != '\0'; p++) if (!(g_ascii_islower(*p) || g_ascii_isdigit(*p) || *p == '_' || *p == '.')) - g_error("Preference %s.%s contains invalid characters", module->name, name); + g_error("Preference \"%s.%s\" contains invalid characters", module->name, name); /* * Make sure there's not already a preference with that |