| 789 | /* Read one zero-terminated string from BUF and advance past the string. */ |
| 790 | |
| 791 | static const char * |
| 792 | read_string (struct dwarf_buf *buf) |
| 793 | { |
| 794 | const char *p = (const char *)buf->buf; |
| 795 | size_t len = strnlen (p, buf->left); |
| 796 | |
| 797 | /* - If len == left, we ran out of buffer before finding the zero terminator. |
| 798 | Generate an error by advancing len + 1. |
| 799 | - If len < left, advance by len + 1 to skip past the zero terminator. */ |
| 800 | size_t count = len + 1; |
| 801 | |
| 802 | if (!advance (buf, count)) |
| 803 | return NULL; |
| 804 | |
| 805 | return p; |
| 806 | } |
| 807 | |
| 808 | /* Read one byte from BUF and advance 1 byte. */ |
| 809 |
no test coverage detected