### Function

# FwupdPlugin memmem_safe

since: 1.8.2

#### Declaration [src]

    gboolean
    fu_memmem_safe (
      const guint8* haystack,
      gsize haystack_sz,
      const guint8* needle,
      gsize needle_sz,
      gsize* offset,
      GError** error
    )

#### Description [src]

Finds a block of memory in another block of memory in a safe way.

Available since: 1.8.2

#### Parameters

`haystack`

  Type: `const guint8*`

  Destination buffer.

  The data is owned by the caller of the function.

`haystack_sz`

  Type: `gsize`

  Maximum size of `haystack`, typically `sizeof(haystack)`.

`needle`

  Type: `const guint8*`

  Source buffer.

  The data is owned by the caller of the function.

`needle_sz`

  Type: `gsize`

  Maximum size of `haystack`, typically `sizeof(needle)`.

`offset`

  Type: `gsize*`

  Offset in bytes `needle` has been found in `haystack`.

  The argument will be set by the function.
  The argument can be set to `NULL` by the function.

`error`

  Type: `GError **`

  The return location for a recoverable error.

  The argument can be `NULL`.
  If the return location is not `NULL`, then you must initialize it to a `NULL` `GError*`.
  The argument will be left initialized to `NULL` by the function if there are no errors.
  In case of error, the argument will be set to a newly allocated `GError`; the caller will take ownership of the data, and be responsible for freeing it.

#### Return value

Type: `gboolean`

`TRUE` if the needle was found in the haystack, `FALSE` otherwise.