Closed radosroka closed 1 year ago
In escape_shell(), what is expected_size used for? What is the longest length input might be? buffer needs to be at least 4 times it's size. Buffer also might be better off on the heap, meaning a static char [] just above the function for machines with limited stack space.
In format_value(), maybe
if (need_escape)
out = escape_shell(str, ...
else
if (asprintf(&out, ...
out = NULL;
to avoid calling free at all. Also, static analyzers may not be able to reason about whether it needs freeing when "?" is assigned.
@stevegrubb you can check it now it's little bit cleaner.
OK, looks good.