rangecheck(3)
π rangecheck(3) β pointer range checking, bestie edition π
okay so this is rangecheck.h from the Library Functions Manual, and it's genuinely one of those lowkey life-saving little headers. let me put you on. π«Ά
β¨ NAME β¨
rangecheck.h β pointer range checking, aka "is this pointer actually inside this buffer or are we about to have a bad time" π¦
πΈ SYNTAX πΈ
#include <libowfat/rangecheck.h>
int range_validbuf(const void* buf,size_t len);
int range_ptrinbuf(const void* buf,size_t len,const void* ptr);
int range_bufinbuf(const void* buf1,size_t len1,
const void* buf2,size_t len2);
int range_arrayinbuf(const void* buf,size_t len,
const void* arraystart,
size_t elements,size_t membersize);
int range_strinbuf(const void* buf,size_t len,const void* string);
int range_str2inbuf(const void* buf,size_t len,const void* string);
int range_str4inbuf(const void* buf,size_t len,const void* string);
like, seven whole little functions, all int, all vibing. π
π DESCRIPTION π
so rangecheck.h serves up several routines for range checking pointers. and the way that this matters β these routines are literally meant for code that has to validate the syntax and semantics of buffers coming in from untrusted sources π like a network connection or an input file. yes bestie, the scary ones.
basically if you're taking bytes from the wild and you're about to go poking around in them, you check the ranges first. no cap. it's giving responsible. it's giving paranoid in a healthy way. π§
π RETURN VALUE π
the routines all return 0 on error, or 1 if the pointers were in range.
that's it. that's the whole vibe check. 0 = nope π, 1 = slay β¨.
π SEE ALSO π
range_validbuf(3)range_ptrinbuf(3)range_bufinbuf(3)range_arrayinbuf(3)range_strinbuf(3)range_str2inbuf(3)range_str4inbuf(3)
go read them, they're all little besties that work together π«Ά
and that's the page!! it lives in section 3 of the Library Functions Manual, and the footer at the bottom just says rangecheck(3) all over again, like a little signature β so consider this your sign-off: rangecheck(3), mwah, go validate your buffers, ily πππ¦
π¦ where this page comes from
- alpine 3.24: libowfat-doc 0.34-r0 Β· GPL-2.0-only
- debian bookworm: libowfat-dev 0.32-4 Β· GPL-2.0-only
- debian trixie: libowfat-dev 0.32-5 Β· GPL-2.0-only
- nixos 26.05: libowfat 0.34
- nixpkgs unstable: libowfat 0.34
- opensuse-leap 16.0: libowfat-devel 0.33-bp160.1.11 Β· GPL-2.0-only
- opensuse-leap 16.0: libowfat-devel 0.33-bp160.1.11 Β· GPL-2.0-only
- opensuse-leap 16.0: libowfat-devel 0.33-bp160.1.11 Β· GPL-2.0-only
- opensuse-leap 16.0: libowfat-devel 0.33-bp160.1.11 Β· GPL-2.0-only
- ubuntu noble: libowfat-dev 0.32-4.1build1 Β· GPL-2.0-only
- ubuntu questing: libowfat-dev 0.32-5
- ubuntu resolute: libowfat-dev 0.34-2 Β· GPL-2.0-only
- ubuntu stonking: libowfat-dev 0.34-2 Β· GPL-2.0-only
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms