Skip to content

Commit c12c002

Browse files
committed
Fixed crash when trying to enter anything into the console in the Debug build.
1 parent bcb6a23 commit c12c002

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/xrEngine/line_edit_control.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -578,10 +578,10 @@ void line_edit_control::add_inserted_text()
578578
m_inserted[m_buffer_size - 1 - m_p1] = 0;
579579
new_size = xr_strlen(m_inserted);
580580
}
581-
strncpy_s(buf + m_p1, m_buffer_size, m_inserted, _min(new_size, m_buffer_size - m_p1)); // part 2
581+
strncpy_s(buf + m_p1, m_buffer_size - m_p1, m_inserted, _min(new_size, m_buffer_size - m_p1)); // part 2
582582

583583
u8 ds = (m_insert_mode && m_p2 < old_edit_size) ? 1 : 0;
584-
strncpy_s(buf + m_p1 + new_size, m_buffer_size, m_edit_str + m_p2 + ds,
584+
strncpy_s(buf + m_p1 + new_size, m_buffer_size - (m_p1 + new_size), m_edit_str + m_p2 + ds,
585585
_min(old_edit_size - m_p2 - ds, m_buffer_size - m_p1 - new_size)); // part 3
586586
buf[m_buffer_size] = 0;
587587

0 commit comments

Comments
 (0)