Can sscanf() modify unmatched conversions
Lukáš Jiřiště
gymnazium.jiriste@gmail.com
Mon Aug 18 05:59:32 GMT 2025
>
> What does that have to do with the question that I asked?
The sscanf does nothing with the excessive arguments. When you don't
initialize them and the optional one does not get filled, you would then
free a non-initialized pointer which is UB (probably leads to segfault as
you are freeing memory that does not belong to you). But when you
initialize it to NULL, it remains as NULL when not used. And using free on
NULL is valid (it does nothing).
More information about the Libc-help
mailing list