/* If we don't find a terminating NUL, return -1 and set *err and *err_info appropriately.  */
static int name_resolution_block_find_name_end(const char *p, guint record_len, int *err, gchar **err_info)
/* If we don't find a terminating NUL, return -1 and set *err and *err_info appropriately.  */
static int name_resolution_block_find_name_end(const char *p, guint record_len, int *err, gchar **err_info)
{
    int namelen;
    namelen = 0;
    for (;;) {
        if (record_len == 0) {
            *err = WTAP_ERR_BAD_FILE;
            *err_info = g_strdup("pcapng_read_name_resolution_block: NRB record has non-null-terminated host name");
            return -1;
        }
        if (*p == '\0')
            break;
        p++;
        record_len--;
        namelen++;
    }
    return namelen + 1;
}