Fix regression in text_handler_multiselect in the text frontend
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 do just that. We first run a loop to compute the size needed for the answer, then we free/alloc answer for this size, and we can finally use it. Closes: #1025133
parent
63286e5c
No related branches found
No related tags found
Please register or sign in to comment