From 7c586d061e7308e0e8164827fa0e14b470921d67 Mon Sep 17 00:00:00 2001 From: divverent Date: Mon, 13 Jun 2011 07:10:08 +0000 Subject: [PATCH] MSG_ReadString: if hitting the max length of the string, continue to read until NUL anyway (prevents msg_badread when reading an overlong string) git-svn-id: svn://svn.icculus.org/twilight/trunk/darkplaces@11195 d7cf8633-e32d-0410-b094-e92efae38249 --- common.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/common.c b/common.c index 8e9bf40a..5539b0af 100644 --- a/common.c +++ b/common.c @@ -496,6 +496,9 @@ char *MSG_ReadString (void) int l,c; for (l = 0;l < (int) sizeof(string) - 1 && (c = MSG_ReadByte()) != -1 && c != 0;l++) string[l] = c; + // read the rest of the string anyway + while(c != -1 && c != 0) + c = MSG_ReadByte(); string[l] = 0; return string; } -- 2.39.2