Skip to content

Commit

Permalink
Fix: warning detected via ccc-analyzer
Browse files Browse the repository at this point in the history
warning: Assigned value is garbage or undefined
  • Loading branch information
jjnicola committed Oct 21, 2022
1 parent d145331 commit 815c1a2
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions nasl/nasl_scanner_glue.c
Original file line number Diff line number Diff line change
Expand Up @@ -975,10 +975,11 @@ security_something (lex_ctxt *lexic, proto_post_something_t proto_post_func,
int len = get_var_size_by_name (lexic, "data");
int i;

dup = g_memdup2 (data, len + 1);
dup = g_malloc0 ((len + 1) * sizeof (char *));
memcpy (dup, data, len + 1);

for (i = 0; i < len; i++)
if (dup[i] == 0)
if (dup[i] == '\0')
dup[i] = ' ';
}

Expand Down

0 comments on commit 815c1a2

Please sign in to comment.