| 357 | } |
| 358 | |
| 359 | char *MSG_ReadStringLine( msg_t *msg ) { |
| 360 | static const int STRING_SIZE = MAX_STRING_CHARS; |
| 361 | static char string[STRING_SIZE]; |
| 362 | int l,c; |
| 363 | |
| 364 | MSG_ReadByteAlign( msg ); |
| 365 | l = 0; |
| 366 | do { |
| 367 | c = MSG_ReadByte(msg); // use ReadByte so -1 is out of bounds |
| 368 | if (c == -1 || c == 0 || c == '\n') { |
| 369 | break; |
| 370 | } |
| 371 | // translate all fmt spec to avoid crash bugs |
| 372 | if ( c == '%' ) { |
| 373 | c = '.'; |
| 374 | } |
| 375 | string[l] = c; |
| 376 | l++; |
| 377 | } while (l < STRING_SIZE - 1); |
| 378 | |
| 379 | string[l] = 0; |
| 380 | |
| 381 | return string; |
| 382 | } |
| 383 | |
| 384 | |
| 385 | void MSG_ReadData( msg_t *msg, void *data, int len ) { |
no test coverage detected