Merge pull request #469 from juppytt/master

Heap buffer overflow in search fix (#467) and stack buffer overflow
This commit is contained in:
Martin Dvorak 2022-12-10 20:33:42 +01:00 committed by GitHub
commit 79bc44a263
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 4 additions and 2 deletions

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();

View file

@ -114,7 +114,8 @@ char* parse_history_line(char *l)
!isZsh ||
#endif
!l ||
l[0]!=':') {
l[0]!=':' ||
l[1]!=' ') {
return l;
}