diff options
author | Kristian Amlie <kristian.amlie@northern.tech> | 2018-04-04 11:09:57 +0300 |
---|---|---|
committer | Tom Rini <trini@konsulko.com> | 2018-04-10 22:19:15 +0300 |
commit | 8a0b827b1a12cf3e224a4c083de7a1e448356a16 (patch) | |
tree | caf763d47e8f3f8a4302d8635f524506726089b6 /tools/env | |
parent | 2f8ffb0655ccb7f5cc5568a52ff45272b19fa5d3 (diff) | |
download | u-boot-8a0b827b1a12cf3e224a4c083de7a1e448356a16.tar.xz |
fw_printenv: Fix crash due to incorrect size for malloc'ed string.
Using sizeof gives the size of the pointer only, not the string. This
could easily lead to crashes when using -l argument.
Signed-off-by: Kristian Amlie <kristian.amlie@northern.tech>
Diffstat (limited to 'tools/env')
-rw-r--r-- | tools/env/fw_env_main.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/tools/env/fw_env_main.c b/tools/env/fw_env_main.c index d93a915fd1..fb4afa5ee9 100644 --- a/tools/env/fw_env_main.c +++ b/tools/env/fw_env_main.c @@ -239,7 +239,7 @@ int main(int argc, char *argv[]) argv += optind; if (env_opts.lockname) { - lockname = malloc(sizeof(env_opts.lockname) + + lockname = malloc(strlen(env_opts.lockname) + sizeof(CMD_PRINTENV) + 10); if (!lockname) { fprintf(stderr, "Unable allocate memory"); |