From 17236152bf80436567bf3f1f27af3915364ec0b6 Mon Sep 17 00:00:00 2001 From: Kristian Amlie Date: Wed, 4 Apr 2018 10:01:04 +0200 Subject: [PATCH 5/5] fw_env_main.c: Fix incorrect size for malloc'ed string. Using sizeof gives the size of the pointer only, not the string. Signed-off-by: Kristian Amlie --- tools/env/fw_env_main.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools/env/fw_env_main.c b/tools/env/fw_env_main.c index 6fdf41c..f8e3f07 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"); -- 2.7.4