Function

FwupdPluginmemmem_safe

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 const guint8*
 

Destination buffer.

 The data is owned by the caller of the function.
haystack_sz gsize
 

Maximum size of haystack, typically sizeof(haystack)

needle const guint8*
 

Source buffer.

 The data is owned by the caller of the function.
needle_sz gsize
 

Maximum size of haystack, typically sizeof(needle)

offset 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.
 The called function takes ownership of the data, and is responsible for freeing it.
error GError **
  The return location for a GError*, or NULL.

Return value

Returns: gboolean
 

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