Commit 7d59d75e authored by Bernhard Nortmann's avatar Bernhard Nortmann
Browse files

fexc: Regroup code in script_decompile_bin()



Move some lines so that the safeguards run (and exit, if needed)
before the normal output of header information.
Signed-off-by: default avatarBernhard Nortmann <bernhard.nortmann@web.de>
parent ef545814
...@@ -315,10 +315,13 @@ int script_decompile_bin(void *bin, size_t bin_size, ...@@ -315,10 +315,13 @@ int script_decompile_bin(void *bin, size_t bin_size,
unsigned int i; unsigned int i;
struct script_bin_head *head = bin; struct script_bin_head *head = bin;
pr_info("%s: version: %u.%u.%u\n", filename, if ((head->version[0] > SCRIPT_BIN_VERSION_LIMIT) ||
(head->version[1] > SCRIPT_BIN_VERSION_LIMIT) ||
(head->version[2] > SCRIPT_BIN_VERSION_LIMIT)) {
pr_err("Malformed data: version %u.%u.%u.\n",
head->version[0], head->version[1], head->version[2]); head->version[0], head->version[1], head->version[2]);
pr_info("%s: size: %zu (%u sections)\n", filename, return 0;
bin_size, head->sections); }
if (head->sections > SCRIPT_BIN_SECTION_LIMIT) { if (head->sections > SCRIPT_BIN_SECTION_LIMIT) {
pr_err("Malformed data: too many sections (%u).\n", pr_err("Malformed data: too many sections (%u).\n",
...@@ -326,13 +329,10 @@ int script_decompile_bin(void *bin, size_t bin_size, ...@@ -326,13 +329,10 @@ int script_decompile_bin(void *bin, size_t bin_size,
return 0; return 0;
} }
if ((head->version[0] > SCRIPT_BIN_VERSION_LIMIT) || pr_info("%s: version: %u.%u.%u\n", filename,
(head->version[1] > SCRIPT_BIN_VERSION_LIMIT) ||
(head->version[2] > SCRIPT_BIN_VERSION_LIMIT)) {
pr_err("Malformed data: version %u.%u.%u.\n",
head->version[0], head->version[1], head->version[2]); head->version[0], head->version[1], head->version[2]);
return 0; pr_info("%s: size: %zu (%u sections)\n", filename,
} bin_size, head->sections);
/* TODO: SANITY: compare head.sections with bin_size */ /* TODO: SANITY: compare head.sections with bin_size */
for (i=0; i < head->sections; i++) { for (i=0; i < head->sections; i++) {
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment