fix stack overflow read

This commit is contained in:
Juhee Kim 2022-12-07 11:26:53 +09:00
parent 5ebf10a42c
commit 1ffe76b5f3

View file

@ -1273,7 +1273,8 @@ void loop_to_select(void)
pattern[0]=0;
// TODO this is too late! > don't render twice
// TODO overflow
strcpy(pattern, hstr->cmdline);
strncpy(pattern, hstr->cmdline, SELECTION_PREFIX_MAX_LNG-1);
pattern[SELECTION_PREFIX_MAX_LNG-1]=0;
while (!done) {
maxHistoryItems=recalculate_max_history_items();