fix off-by-one (premature-truncation, not overflow)
This commit is contained in:
+1
-1
@@ -100,7 +100,7 @@ const char * NetHackQtMessageWindow::GetStr(bool init)
|
|||||||
QListWidgetItem *item = list->item(currgetmsg++);
|
QListWidgetItem *item = list->item(currgetmsg++);
|
||||||
if (item) {
|
if (item) {
|
||||||
QString str = item->text();
|
QString str = item->text();
|
||||||
if (str.toLatin1().length() < (int) sizeof historybuf - 1) {
|
if (str.toLatin1().length() < (int) sizeof historybuf) {
|
||||||
return strcpy(historybuf, str.toLatin1().constData());
|
return strcpy(historybuf, str.toLatin1().constData());
|
||||||
//raw_printf("getstr[%d]='%s'", currgetmsg, result);
|
//raw_printf("getstr[%d]='%s'", currgetmsg, result);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user