1
0
mirror of https://github.com/rkd77/elinks.git synced 2024-11-04 08:17:17 -05:00

Make sure to always check or assert the result of get_opt_rec

Most callers already check.  Add checks to commit_option_values, checkout_option_values, and get_content_type_default.
This commit is contained in:
Miciah Dashiel Butler Masters 2007-12-21 22:49:38 +00:00
parent e531f180e3
commit ae88223664
2 changed files with 5 additions and 0 deletions

View File

@ -1096,6 +1096,8 @@ commit_option_values(struct option_resolver *resolvers,
struct option *option = get_opt_rec(root, name);
int id = resolvers[i].id;
assertm(option, "Bad option '%s' in options resolver", name);
if (memcmp(&option->value, &values[id], sizeof(union option_value))) {
option->value = values[id];
option->flags |= OPT_TOUCHED;
@ -1130,6 +1132,8 @@ checkout_option_values(struct option_resolver *resolvers,
struct option *option = get_opt_rec(root, name);
int id = resolvers[i].id;
assertm(option, "Bad option '%s' in options resolver", name);
values[id] = option->value;
}
}

View File

@ -116,6 +116,7 @@ get_content_type_default(unsigned char *extension)
if (extend < extension) return NULL;
opt_tree = get_opt_rec_real(config_options, "mime.extension");
assert(opt_tree);
foreach (opt, *opt_tree->value.tree) {
unsigned char *namepos = opt->name + strlen(opt->name) - 1;