summaryrefslogtreecommitdiff
path: root/src/stdio/vasprintf.c
AgeCommit message (Collapse)AuthorLines
13 daysasprintf: always clear the result pointer on failureRich Felker-0/+1
previously, the malloc-failure error path cleared it, but other failures from vsnprintf such as EILSEQ or EOVERFLOW left the original contents of the result object in place. leaving any old value in place is allowed, and would be required if the specification did not explicitly permit clobbering it on failure, but it does. by overwriting any old value there with a null pointer, we harden callers that might have failed to check the return value for errors against accessing and possibly exposing unrelated data; instead they will fault on dereference.
2014-06-04simplify vasprintf implementationRich Felker-14/+1
the old implementation preallocated a buffer in order to try to avoid calling vsnprintf more than once. not only did this potentially lead to memory fragmentation from trimming with realloc; it also pulled in realloc/free, which otherwise might not be needed in a static linked program.
2011-02-20cleanup asprintf stuffRich Felker-0/+1
2011-02-12initial check-in, version 0.5.0v0.5.0Rich Felker-0/+27