Skip to content

Fix regression in text_handler_multiselect in the text frontend

Arnaud Rebillout requested to merge arnaudr/cdebconf:master into master

In commit 299ecb85, we started to use readline to prompt the user, and as a result, the answer variable is now dynamically allocated (before, it used to be a 4096 chars array on the stack).

This broke two things.

First, the use of sizeof(answer) is not valid anymore, as it just returns the size of a pointer, not the size of the memory area.

Second, even if we fix the above to get the size right, we have another problem. There's no guarantee that answer is big enough to accomodate the final answer. If we take the example of the d-i tasksel screen, the answer from user is likely to be something like 1 7 12, but then it's converted to values, something like Debian desktop environment, ... MATE, standard system utilities, which is much longer. So if we want to reuse answer to hold the final answer, we'll need to reallocate it.

Therefore, with this commit, we go back to using a static 4096 chars buffer on the stack to hold the final answer, as it was before.

Closes: #xxxxxx

Merge request reports

Loading