Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 1 addition & 2 deletions nasl/nasl_misc_funcs.c
Original file line number Diff line number Diff line change
Expand Up @@ -660,8 +660,7 @@ nasl_gettimeofday (lex_ctxt *lexic)
sprintf (str, "%u.%06u", (unsigned int) t.tv_sec, (unsigned int) t.tv_usec);
retc = alloc_typed_cell (CONST_DATA);
retc->size = strlen (str);
retc->x.str_val = g_malloc0 (retc->size);
strcpy (retc->x.str_val, str);
retc->x.str_val = g_strdup (str);
return retc;
}

Expand Down
7 changes: 4 additions & 3 deletions nasl/nasl_text_utils.c
Original file line number Diff line number Diff line change
Expand Up @@ -1024,7 +1024,7 @@ nasl_insstr (lex_ctxt *lexic)

i1 = get_int_var_by_num (lexic, 2, -1);
i2 = get_int_var_by_num (lexic, 3, -1);
if (i2 > sz1 || i2 == -1)
if (i2 >= sz1 || i2 == -1)
i2 = sz1 - 1;

if (s1 == NULL || s2 == NULL || i1 < 0 || i2 < 0)
Expand All @@ -1045,9 +1045,10 @@ nasl_insstr (lex_ctxt *lexic)
if (i1 > i2)
{
nasl_perror (lexic,
" insstr: warning! 1st index %d greater than 2nd index %d\n",
" insstr: warning! 1st index %ld greater than 2nd index "
"%ld\n",
i1, i2);
sz3 = sz2;
sz3 = i1 + sz2 + (i2 < sz1 - 1 ? sz1 - 1 - i2 : 0);
}
else
sz3 = sz1 + i1 - i2 - 1 + sz2;
Expand Down
Loading