[apps/code] Fix buffer indexes

Change-Id: Ib5748d59fd762af9337e00115f0db4ac5d6d08a9
This commit is contained in:
Léa Saviot
2018-05-17 15:09:47 +02:00
committed by EmilieNumworks
parent 6aaab293d6
commit 7e9b4c1a60

View File

@@ -113,7 +113,7 @@ void ConsoleStore::push(const char marker, const char * text, size_t length) {
}
m_history[i] = marker;
strlcpy(&m_history[i+1], text, textLength+1);
m_history[i+1+length+1] = 0;
m_history[i+1+textLength+1] = 0;
}
ConsoleLine::Type ConsoleStore::lineTypeForMarker(char marker) const {
@@ -148,6 +148,9 @@ void ConsoleStore::deleteLineAtIndex(int index) {
nextLineStart++;
}
nextLineStart++;
if (nextLineStart > k_historySize - 1) {
return;
}
memmove(&m_history[i], &m_history[nextLineStart], (k_historySize - 1) - nextLineStart + 1);
return;
}