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