From c112cdde893c8c67a5c3369b31a5693e9b1c13f6 Mon Sep 17 00:00:00 2001 From: helixhorned Date: Fri, 9 Dec 2011 19:09:14 +0000 Subject: [PATCH] Fix a potential out-of-bounds read and write when loading the help file in Mapster32. git-svn-id: https://svn.eduke32.com/eduke32@2161 1a8010ca-5511-0410-912e-c29ae57300e0 --- polymer/eduke32/source/astub.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/polymer/eduke32/source/astub.c b/polymer/eduke32/source/astub.c index 39f771940..1a1093c9e 100644 --- a/polymer/eduke32/source/astub.c +++ b/polymer/eduke32/source/astub.c @@ -2018,7 +2018,8 @@ static void ReadHelpFile(const char *name) if (charsread>0) { tempbuf[charsread-1]=0; - if (tempbuf[charsread-2]==0x0d) tempbuf[charsread-2]=0; + if (charsread>=2 && tempbuf[charsread-2]==0x0d) + tempbuf[charsread-2]=0; } Bmemcpy(hp->line[j], tempbuf, 80);