range_validbuf(3)

πŸ“¦
version 0.34 Β· 2 versions
  • 0.34 Β· alpine 3.24, debian bookworm, debian trixie, nixos 26.05, nixpkgs unstable, opensuse-leap 16.0, ubuntu noble, ubuntu questing, ubuntu resolute, ubuntu stonking (latest)
  • 0.30 Β· fedora 43, fedora 44, ubuntu jammy
, in alpine 3.24, debian bookworm, debian trixie, nixos 26.05, nixpkgs unstable, opensuse-leap 16.0, ubuntu noble, ubuntu questing, ubuntu resolute, ubuntu stonking

πŸ’– range_validbuf(3) πŸ’–

okay bestie, welcome to the Library Functions Manual, section 3, where we check whether your buffer is even real or just delulu ✨


🌸 NAME 🌸

range_validbuf β€” range check buffer 🫢

like, it vibe-checks a buffer. that's the whole job. she's simple, she's iconic, she's employed.


πŸŽ€ SYNTAX πŸŽ€

#include <libowfat/rangecheck.h>

int range_validbuf(const void* buf,size_t len);

yes girl, include the header, call the function, live your truth πŸ’…


πŸ¦‹ DESCRIPTION πŸ¦‹

range_validbuf does some basic plausibility checks on the buffer buf[0..len-1].

that's it. that's the function. she's not doing a full audit, she's not reading your code's diary, she's just asking "does this buffer pass the vibe check" and honestly? we love a low-effort queen πŸ‘‘


⭐ RETURN VALUE ⭐

  • If the buffer is implausible β€” meaning buf is NULL or buf+len has an integer overflow β€” it returns 0. πŸ’€
  • Otherwise, it returns 1. ✨

so like, 0 = "not me getting a NULL pointer bestie 😭", 1 = "she's valid, periodt 🌈"

ngl the overflow check is the main character here β€” if buf+len wraps around, that math is lying to you and range_validbuf is NOT falling for it πŸ™ˆ

πŸ‘‘ SEE ALSO πŸ‘‘

go read her sister, she's also serving πŸ’œ


that's the whole page bestie!! 🌸 written under the Library Functions Manual banner (section 3, where all the good library functions live), and the footer? it just says range_validbuf(3) with no date on it, so no birthday party for this one πŸŽ‚βœ¨ anyway ily, go check your buffers, stay safe, mwah πŸ’…πŸ’–