From 8e05a06d24c71bfdd3266c5a7eb396ba26672ca7 Mon Sep 17 00:00:00 2001 From: nhmall Date: Fri, 10 Mar 2023 13:54:44 -0500 Subject: [PATCH] fix off-by-one (premature-truncation, not overflow) --- win/Qt/qt_msg.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/win/Qt/qt_msg.cpp b/win/Qt/qt_msg.cpp index 0c995cd97..f61549d81 100644 --- a/win/Qt/qt_msg.cpp +++ b/win/Qt/qt_msg.cpp @@ -100,7 +100,7 @@ const char * NetHackQtMessageWindow::GetStr(bool init) QListWidgetItem *item = list->item(currgetmsg++); if (item) { 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()); //raw_printf("getstr[%d]='%s'", currgetmsg, result); }