### Function

# FwupdPlugin memstrsafe

#### Declaration [src]

    gchar*
    fu_memstrsafe (
      const guint8* buf,
      gsize bufsz,
      gsize offset,
      gsize maxsz,
      GError** error
    )

#### Description [src]

Converts a byte buffer to a ASCII string.

Available since: | 1.9.3

#### Parameters

`buf` | `const guint8*`
| Source buffer.
| The data is owned by the caller of the function.
`bufsz` | `gsize`
| Maximum size of `buf`, typically `sizeof(buf)`
`offset` | `gsize`
| Offset in bytes into `buf` to read from.
`maxsz` | `gsize`
| Maximum size of returned string.
`error` | `GError **`
| The return location for a `GError*`, or `NULL`.

#### Return value

Returns: | `gchar*`
| A string, or `NULL` on error.
| The caller of the function takes ownership of the data, and is responsible for freeing it.
| The value is a NUL terminated UTF-8 string.