benilla-re systems structs docs

_sprintf

function · crt · primitive

Address
0x73fec4 · 82 bytes, up to 0x73ff15
Signature
int __cdecl (char *buffer, const char *format, ...)
Meaning
Formats into a buffer with no bound through __output, ends it with a NUL and returns the count
Confidence
verified, proof one
Name from
the community database (idb)
Finding
crt/printf#the-string-front-ends
Test
crt::crt_sprintf_states_difftest, crt::crt_sprintf_difftest, crt::crt_sprintf_float_difftest

Finding: The string front ends in crt: formatted output

sprintf and _vsprintf give __output the count 0x7fffffff; _snprintf and _vsnprintf give it the caller's count, as a signed int. One more decrement of the count then decides the end: at zero or above, a NUL at the cursor; below zero, nothing. So a text shorter than the count ends in a NUL and returns its length; a text of exactly the count has no NUL and returns the count; a longer one stops at the count with no NUL and returns -1. A count of 0 or from 0x80000001 up leaves no room: nothing is written, and the return is -1, or 0 for an empty text. 0x80000000 wraps to 0x7fffffff on its first decrement and has no bound.

The derivation is in the doc.

Callers 16

Callees 2

Calls and jumps by a bare address, from tables/calls.tsv.