File tree Expand file tree Collapse file tree 1 file changed +8
-3
lines changed
Expand file tree Collapse file tree 1 file changed +8
-3
lines changed Original file line number Diff line number Diff line change @@ -1707,7 +1707,7 @@ exec_nasl_script (struct script_infos *script_infos, int mode)
17071707 }
17081708 else if (!(mode & NASL_EXEC_PARSE_ONLY ))
17091709 {
1710- char * p ;
1710+ char * p , * name_aux ;
17111711
17121712 bzero (& tc , sizeof (tc ));
17131713 tc .type = CONST_INT ;
@@ -1720,14 +1720,18 @@ exec_nasl_script (struct script_infos *script_infos, int mode)
17201720 add_named_var_to_ctxt (lexic , "description" , & tc );
17211721
17221722 tc .type = CONST_DATA ;
1723- p = strrchr (name , '/' );
1723+ // for preserving the const qualifier during assginment
1724+ name_aux = g_strdup (name );
1725+ p = strrchr (name_aux , '/' );
17241726 if (p == NULL )
1725- p = (char * ) name ;
1727+ p = (char * ) name_aux ;
17261728 else
17271729 p ++ ;
1730+
17281731 tc .x .str_val = p ;
17291732 tc .size = strlen (p );
17301733 add_named_var_to_ctxt (lexic , "SCRIPT_NAME" , & tc );
1734+ g_free (name_aux );
17311735
17321736 truc = (lex_ctxt * ) ctx .tree ;
17331737 if ((ret = nasl_exec (lexic , ctx .tree )) == NULL )
@@ -1737,6 +1741,7 @@ exec_nasl_script (struct script_infos *script_infos, int mode)
17371741
17381742 if ((pf = get_func_ref_by_name (lexic , "on_exit" )) != NULL )
17391743 nasl_func_call (lexic , pf , NULL );
1744+
17401745 }
17411746
17421747 if (g_chdir (old_dir ) != 0 )
You can’t perform that action at this time.
0 commit comments