platform_external_dtc/libfdt/version.lds
David Gibson 70166d62a2 libfdt: Safer access to strings section
fdt_string() is used to retrieve strings from a DT blob's strings section.
It's rarely used directly, but is widely used internally.

However, it doesn't do any bounds checking, which means in the case of a
corrupted blob it could access bad memory, which libfdt is supposed to
avoid.

This write a safe alternative to fdt_string, fdt_get_string().  It checks
both that the given offset is within the string section and that the string
it points to is properly \0 terminated within the section.  It also returns
the string's length as a convenience (since it needs to determine to do the
checks anyway).

fdt_string() is rewritten in terms of fdt_get_string() for compatibility.

Most of the diff here is actually testing infrastructure.

Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
Tested-by: Alexey Kardashevskiy <aik@ozlabs.ru>
Reviewed-by: Alexey Kardashevskiy <aik@ozlabs.ru>
2018-06-07 11:48:20 +10:00

71 lines
1.4 KiB
Text

LIBFDT_1.2 {
global:
fdt_next_node;
fdt_check_header;
fdt_move;
fdt_string;
fdt_num_mem_rsv;
fdt_get_mem_rsv;
fdt_subnode_offset_namelen;
fdt_subnode_offset;
fdt_path_offset_namelen;
fdt_path_offset;
fdt_get_name;
fdt_get_property_namelen;
fdt_get_property;
fdt_getprop_namelen;
fdt_getprop;
fdt_get_phandle;
fdt_get_alias_namelen;
fdt_get_alias;
fdt_get_path;
fdt_supernode_atdepth_offset;
fdt_node_depth;
fdt_parent_offset;
fdt_node_offset_by_prop_value;
fdt_node_offset_by_phandle;
fdt_node_check_compatible;
fdt_node_offset_by_compatible;
fdt_setprop_inplace;
fdt_nop_property;
fdt_nop_node;
fdt_create;
fdt_add_reservemap_entry;
fdt_finish_reservemap;
fdt_begin_node;
fdt_property;
fdt_end_node;
fdt_finish;
fdt_open_into;
fdt_pack;
fdt_add_mem_rsv;
fdt_del_mem_rsv;
fdt_set_name;
fdt_setprop;
fdt_delprop;
fdt_add_subnode_namelen;
fdt_add_subnode;
fdt_del_node;
fdt_strerror;
fdt_offset_ptr;
fdt_next_tag;
fdt_appendprop;
fdt_create_empty_tree;
fdt_first_property_offset;
fdt_get_property_by_offset;
fdt_getprop_by_offset;
fdt_next_property_offset;
fdt_first_subnode;
fdt_next_subnode;
fdt_address_cells;
fdt_size_cells;
fdt_stringlist_contains;
fdt_stringlist_count;
fdt_stringlist_search;
fdt_stringlist_get;
fdt_resize;
fdt_overlay_apply;
fdt_get_string;
local:
*;
};