| 331 | } |
| 332 | |
| 333 | char *MSG_ReadString( msg_t *msg ) { |
| 334 | static const int STRING_SIZE = MAX_STRING_CHARS; |
| 335 | static char string[STRING_SIZE]; |
| 336 | int l,c; |
| 337 | |
| 338 | MSG_ReadByteAlign( msg ); |
| 339 | l = 0; |
| 340 | do { |
| 341 | c = MSG_ReadByte(msg); // use ReadByte so -1 is out of bounds |
| 342 | if ( c == -1 || c == 0 ) { |
| 343 | break; |
| 344 | } |
| 345 | // translate all fmt spec to avoid crash bugs |
| 346 | if ( c == '%' ) { |
| 347 | c = '.'; |
| 348 | } |
| 349 | |
| 350 | string[l] = c; |
| 351 | l++; |
| 352 | } while (l < STRING_SIZE - 1); |
| 353 | |
| 354 | string[l] = 0; |
| 355 | |
| 356 | return string; |
| 357 | } |
| 358 | |
| 359 | char *MSG_ReadStringLine( msg_t *msg ) { |
| 360 | static const int STRING_SIZE = MAX_STRING_CHARS; |
no test coverage detected