File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 11/* Yash: yet another shell */
22/* editing.c: main editing module */
3- /* (C) 2007-2025 magicant */
3+ /* (C) 2007-2026 magicant */
44
55/* This program is free software: you can redistribute it and/or modify
66 * it under the terms of the GNU General Public License as published by
@@ -3247,13 +3247,14 @@ void cmd_emacs_delete_horizontal_space(wchar_t c __attribute__((unused)))
32473247 * If the count is specified, blanks are replaced with `count' spaces. */
32483248void cmd_emacs_just_one_space (wchar_t c __attribute__((unused )))
32493249{
3250+ #define MAX_SPACE_COUNT 1000 /* The count is limited to avoid overflow. */
32503251 int count = get_count (1 );
32513252 if (count < 0 )
32523253 count = 0 ;
3253- else if (count > 1000 )
3254- count = 1000 ;
3254+ else if (count > MAX_SPACE_COUNT )
3255+ count = MAX_SPACE_COUNT ;
32553256
3256- wchar_t s [count + 1 ];
3257+ wchar_t s [MAX_SPACE_COUNT + 1 ];
32573258 wmemset (s , L' ' , count );
32583259 s [count ] = L'\0' ;
32593260
You can’t perform that action at this time.
0 commit comments