1range_arrayinbuf(3) Library Functions Manual range_arrayinbuf(3)
2
3
4
6 range_arrayinbuf - range check for array in buffer
7
9 #include <rangecheck.h>
10
11 int range_arrayinbuf(const void* buf,size_t len,
12 const void* arraystart,
13 size_t elements,size_t membersize);
14
15
17 range_arrayinbuf checks that the array starting at arraystart consist‐
18 ing of elements members of size membersize each starts and ends within
19 the buffer buf[0..len-1].
20
21 If the array is 0-terminated and you don't know the length beforehand,
22 use range_strinbuf, range_str2inbuf or range_str4inbuf instead.
23
25 If the buffer is implausible (buf is NULL or buf+len has an integer
26 overflow), return 0.
27
28 If the array is implausible (arraystart is NULL, elements*membersize
29 overflows, or calculating the byte offset of the last element over‐
30 flows), return 0.
31
32 If the first or last element of the array points before or after the
33 buffer, return 0.
34
35 Otherwise, return 1.
36
38 rangecheck(3)
39
40
41
42 range_arrayinbuf(3)