mirror of
https://github.com/Fishwaldo/u-boot.git
synced 2025-03-18 13:11:31 +00:00
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>
This commit is contained in:
parent
2f8ffb0655
commit
8a0b827b1a
1 changed files with 1 additions and 1 deletions
2
tools/env/fw_env_main.c
vendored
2
tools/env/fw_env_main.c
vendored
|
@ -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");
|
||||
|
|
Loading…
Add table
Reference in a new issue