safec  3.5.1
Safe C Library - ISO TR24731 Bounds Checking Interface
vsscanf_s.c File Reference
#include "safe_lib.h"
+ Include dependency graph for vsscanf_s.c:

Functions

EXPORT int vsscanf_s (const char *restrict buffer, const char *restrict fmt, va_list ap)
 The vsscanf_s function reads a formatted string, and writes to a list of arguments. More...
 

Function Documentation

◆ vsscanf_s()

EXPORT int vsscanf_s ( const char *restrict  buffer,
const char *restrict  fmt,
va_list  ap 
)

The vsscanf_s function reads a formatted string, and writes to a list of arguments.

Reaching the end of the string is equivalent to reaching the end-of-file condition for fscanf.

Remarks
SPECIFIED IN
Parameters
[in]bufferpointer to a null-terminated string to read from
[in]fmtformat-control string.
[out]aparguments to write to
Precondition
Neither buffer nor fmt shall be a null pointer.
fmt shall not contain the conversion specifier n
None of the arguments corresponding to s is a null pointer. (not yet)
No encoding error shall occur.
c, s, and %[ conversion specifiers each expect two arguments (the usual pointer and a value of type rsize_t indicating the size of the receiving array, which may be 1 when reading with a c into a single character) and except that the following errors are detected at runtime and call the currently installed constraint handler function. (not yet)
Warning
The current implementation just does some basic argument checks and then calls the native vsscanf() libc function. Thus the s null pointer check and the two-arg versions of c, s, and %[ are not yet implemented.
Returns
Number of receiving arguments successfully assigned, or EOF if read failure occurs before the first receiving argument was assigned or if there is a runtime constraint violation.
Return values
>0 on success, the number of arguments assigned
EOFon error
See also
vvsscanf_s(), swscanf_s(), vsnprintf_s()