提交 8a0b827b 编写于 作者: K Kristian Amlie 提交者: Tom Rini

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: NKristian Amlie <kristian.amlie@northern.tech>
上级 2f8ffb06
......@@ -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");
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册