---
name: "range_arrayinbuf"
section: "3"
platform: "linux"
package: "libowfat-dev"
version: "0.32-5"
release: "Debian 13 (Trixie)"
platforms: ["linux"]
url: "https://new.carta.tech/range_arrayinbuf"
---

# range\_arrayinbuf(3)

range check for array in buffer

## NAME

range\_arrayinbuf - range check for array in buffer

## SYNTAX

**#include \<libowfat/rangecheck.h\>**

int **range\_arrayinbuf**(const void\* buf,size\_t len,\
                      const void\* arraystart,\
                      size\_t elements,size\_t membersize);

## DESCRIPTION

range\_arrayinbuf checks that the array starting at *arraystart* consisting of *elements* members of size *membersize* each starts and ends within the buffer *buf*\[0..*len*-1\].

If the array is 0-terminated and you don't know the length beforehand, use range\_strinbuf, range\_str2inbuf or range\_str4inbuf instead.

## RETURN VALUE

If the buffer is implausible (buf is NULL or buf+len has an integer overflow), return 0.

If the array is implausible (arraystart is NULL, elements\*membersize overflows, or calculating the byte offset of the last element overflows), return 0.

If the first or last element of the array points before or after the buffer, return 0.

Otherwise, return 1.

## SEE ALSO

[rangecheck(3)](/rangecheck/3.md)
