range_strinbuf(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

okay so bestie, welcome to range_strinbuf(3) from the Library Functions Manual β€” it's giving range check for string in buffer, and honestly it's a tiny lil safety bouncer for your C strings. πŸ’–

✨ NAME ✨

range_strinbuf β€” range check for string in buffer

πŸŽ€ SYNTAX πŸŽ€

#include <libowfat/rangecheck.h>

int range_strinbuf(const void* buf,size_t len,const void* stringstart);

πŸ¦‹ DESCRIPTION πŸ¦‹

range_strinbuf checks that the ASCIIZ-string starting at stringstart starts and ends within the buffer buf[0..len-1].

If the string is not 0-terminated but the length is known beforehand, use range_arrayinbuf instead. iykyk, different function, different vibe.

πŸ’… RETURN VALUE πŸ’…

  • If the buffer is implausible (buf is NULL or buf+len has an integer overflow), return 0.
  • If stringstart points before or after the buffer, return 0.
  • If there is no '\0' within the buffer, return 0.
  • Otherwise, return 1.

πŸ”₯ SEE ALSO πŸ”₯

rangecheck(3)


xoxo, signing off from the Library Functions Manual, it's your girl range_strinbuf(3) 🫢✨