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:
parent
e531f180e3
commit
ae88223664
@ -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;
|
||||
}
|
||||
}
|
||||
|
@ -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;
|
||||
|
Loading…
Reference in New Issue
Block a user