projects
/
oweals
/
u-boot.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
2f8ffb0
)
fw_printenv: Fix crash due to incorrect size for malloc'ed string.
author
Kristian Amlie
<kristian.amlie@northern.tech>
Wed, 4 Apr 2018 08:09:57 +0000
(10:09 +0200)
committer
Tom Rini
<trini@konsulko.com>
Tue, 10 Apr 2018 19:19:15 +0000
(15:19 -0400)
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>
tools/env/fw_env_main.c
patch
|
blob
|
history
diff --git
a/tools/env/fw_env_main.c
b/tools/env/fw_env_main.c
index d93a915fd142827e2259cd78b260565e4c4e76e6..fb4afa5ee91c427a4604f4d602a299c11febbdae 100644
(file)
--- 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(s
izeof
(env_opts.lockname) +
+ lockname = malloc(s
trlen
(env_opts.lockname) +
sizeof(CMD_PRINTENV) + 10);
if (!lockname) {
fprintf(stderr, "Unable allocate memory");