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

πŸ’– NAME πŸ’–

okay so bestie, this is range_str2inbuf β€” she does a range check for a string in a buffer. no cap. ✨


✨ SYNTAX ✨

#include <libowfat/rangecheck.h>

int range_str2inbuf(const void* buf,size_t len,const void* string);

πŸ¦‹ DESCRIPTION πŸ¦‹

range_str2inbuf checks that the zero terminated UTF-16-string starting at string starts and ends within the buffer buf[0..len-1]. she's basically making sure your string is not out here wandering into the void, periodt. πŸ’…

If the string is not 0-terminated but the length is known beforehand, use range_arrayinbuf instead. that's the sister function for when you already know how long it is, iykyk. 🫢


🌸 RETURN VALUE 🌸

  • If the buffer is implausible (buf is NULL or buf+len has an integer overflow), return 0. that's a hard no. πŸ’€
  • If string points before or after the buffer, return 0. she's outside the function's assigned area, not invited. πŸ™ˆ
  • If there is no zero terminator within the buffer, return 0. no end in sight? not today. 😭
  • Otherwise, return 1. slay! she passed the vibe check. πŸ‘‘

πŸŽ€ SEE ALSO πŸŽ€


this has been your girl range_str2inbuf(3) from the Library Functions Manual, no date given, just vibes and range checks. stay safe out there, bestie πŸ’–βœ¨πŸŽ€