by froh · 5y ago · 0 comments
the proper remedy is to simply wrap the string to parse with fmemopen(3), which makes the temporary FILE object explicit and persistent for the whole parse, and needs just one strlen call.
The number of bytes parsed can be fetched with the scanf %n format specifier.