Oops when mpr() is misused for printing partial lines
Such misuse creates a bulletin with a partial line. The read command normally merges it with the next one, but if the bulletins are more than five seconds apart (clock jumped somehow), we get a bulletin header in the middle of a line.
This commit is contained in:
parent
e002bf207f
commit
2f4b5973ce
1 changed files with 4 additions and 2 deletions
|
@ -500,8 +500,9 @@ pr_beep(void)
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Print to country CN similar to printf().
|
* Print complete lines to country CN similar to printf().
|
||||||
* Use printf-style FORMAT with the optional arguments.
|
* Use printf-style FORMAT with the optional arguments. FORMAT must
|
||||||
|
* end with '\n'.
|
||||||
* If CN is zero, don't print anything.
|
* If CN is zero, don't print anything.
|
||||||
* Else, if CN is the current player and we're not in the update,
|
* Else, if CN is the current player and we're not in the update,
|
||||||
* print just like pr(). Else print into a bulletin.
|
* print just like pr(). Else print into a bulletin.
|
||||||
|
@ -514,6 +515,7 @@ mpr(int cn, char *format, ...)
|
||||||
char buf[4096];
|
char buf[4096];
|
||||||
va_list ap;
|
va_list ap;
|
||||||
|
|
||||||
|
CANT_HAPPEN(!format[0] || format[strlen(format) - 1] != '\n');
|
||||||
if (!cn)
|
if (!cn)
|
||||||
return;
|
return;
|
||||||
va_start(ap, format);
|
va_start(ap, format);
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue