Skip to content

Commit

Permalink
check varname return.
Browse files Browse the repository at this point in the history
  • Loading branch information
jfdelnero committed Nov 15, 2023
1 parent 4a09abf commit cdfeab9
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion lib_jtag_core/src/script/script.c
Original file line number Diff line number Diff line change
Expand Up @@ -1282,6 +1282,7 @@ static int cmd_initarray( script_ctx * ctx, char * line)
ret = JTAG_CORE_BAD_PARAMETER;

strcpy(varvalue,"0");
varname[0] = '\0';

i = get_param_str( ctx, line, 1, varname );
j = get_param( ctx, line, 2, varsize );
Expand All @@ -1291,7 +1292,7 @@ static int cmd_initarray( script_ctx * ctx, char * line)
{
size = atoi(varsize);

if(size >= 0)
if(size >= 0 && strlen(varname) )
{
ptr = getEnvVar( *((envvar_entry **)ctx->env),(char*)&varname, NULL);
if(ptr)
Expand Down

0 comments on commit cdfeab9

Please sign in to comment.