scan_asn1derlength(3)
β¨ scan_asn1derlength(3) β¨
okay bestie, welcome to the library functions manual, this is the page for scan_asn1derlength (and its lil sibling scan_asn1derlengthvalue, we'll get there) π«Ά
π NAME π
scan_asn1derlengthvalue β decode an unsigned integer from ASN.1 DER length encoding π
π¦ SYNTAX π¦
#include <libowfat/scan.h>
size_t scan_asn1derlengthvalue(const char *src,size_t len,unsigned long long *dest);
like yes, that's the whole thing, she's not complicated πΈ
π DESCRIPTION π
so scan_asn1derlengthvalue decodes an unsigned integer in ASN.1 DER length encoding out of a memory area that's holding binary data. she writes the decoded value into dest and returns the number of bytes she read from src. that's it, that's the job, and she does it flawlessly π
scan_asn1derlength never reads more than len bytes from src. no cap. and if the sequence is longer than that, or if the memory area is holding an invalid sequence, then scan_asn1derlength returns 0 and does not touch dest. she just minds her business and walks away π
bestie listen: if she bails and returns0,deststays exactly how you left it. no sneaky writes. π
the longest spec-compliant ASN.1 DER length is 128 bytes, but this implementation will return an error if the value doesn't fit into the target integer type. in practice the largest sequence is sizeof(*dest)+1. yes, that's the vibe. π₯
also, this implementation will reject values that aren't encoded in the minimum amount of bytes. she's picky like that, and honestly? iconic. π
if you need to decode the length value so you can parse actual ASN.1 tag/length/value structures, please consider using scan_asn1derlength instead, because it will do additional checking for you. let her handle the extra work, you deserve the break π§
π SEE ALSO π
fmt_asn1derlength(3)scan_asn1derlengthvalue(3)
and that's the whole page, no notes. this was the scan_asn1derlength(3) manual page from the Library Functions Manual β mwah, go forth and parse those lengths responsibly πβ¨
π¦ 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