mirror of
https://github.com/OpenTTD/OpenTTD.git
synced 2025-03-06 22:28:56 +00:00
(svn r8843) -Fix
-Fix: Off-by-one error in accessing a buffer (if you start at the second byte you have to subtract one from the size) Also avoid an unnecessary buffer copy and strlcpy() abuse NOTE: 0.5 candidate
This commit is contained in:
parent
103d119c51
commit
c834320611
@ -2729,11 +2729,11 @@ static void GRFComment(byte *buf, int len)
|
|||||||
*
|
*
|
||||||
* V ignored Anything following the 0C is ignored */
|
* V ignored Anything following the 0C is ignored */
|
||||||
|
|
||||||
static char comment[256];
|
|
||||||
if (len == 1) return;
|
if (len == 1) return;
|
||||||
|
|
||||||
ttd_strlcpy(comment, (char*)(buf + 1), minu(sizeof(comment), len));
|
int text_len = len - 1;
|
||||||
grfmsg(2, "GRFComment: %s", comment);
|
const char *text = (const char*)(buf + 1);
|
||||||
|
grfmsg(2, "GRFComment: %.*s", text_len, text);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Action 0x0D (GLS_SAFETYSCAN) */
|
/* Action 0x0D (GLS_SAFETYSCAN) */
|
||||||
|
Loading…
Reference in New Issue
Block a user