From: divverent Date: Mon, 13 Jun 2011 07:10:08 +0000 (+0000) Subject: MSG_ReadString: if hitting the max length of the string, continue to read until NUL... X-Git-Tag: xonotic-v0.5.0~120 X-Git-Url: https://git.rm.cloudns.org/?a=commitdiff_plain;h=2fbbec069b55898b715100552406e6ea9bc14231;p=xonotic%2Fdarkplaces.git 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 ::stable-branch::merge=7c586d061e7308e0e8164827fa0e14b470921d67 --- 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; }