mirror of
https://github.com/MidnightCommander/mc
synced 2024-12-22 20:36:50 +03:00
Ticket #2123: crash while copying into directory named "????"
1. create directory named "????" and enter into this directory 2. point at any file in other panel 3. press F5 and Enter Segfault Signed-off-by: Slava Zanko <slavazanko@gmail.com>
This commit is contained in:
parent
3108909bb0
commit
973bbb70a2
@ -118,14 +118,25 @@ mc_search__translate_replace_glob_to_regex (gchar *str)
|
||||
{
|
||||
GString *buff = g_string_new ("");
|
||||
int cnt = '0';
|
||||
|
||||
gboolean escaped_mode = FALSE;
|
||||
while (*str) {
|
||||
char c = *str++;
|
||||
switch (c) {
|
||||
case '\\':
|
||||
if (!escaped_mode)
|
||||
{
|
||||
escaped_mode = TRUE;
|
||||
continue;
|
||||
}
|
||||
break;
|
||||
case '*':
|
||||
case '?':
|
||||
if (!escaped_mode)
|
||||
{
|
||||
g_string_append_c (buff, '\\');
|
||||
c = ++cnt;
|
||||
continue;
|
||||
}
|
||||
break;
|
||||
/* breaks copying: mc uses "\0" internally, it must not be changed */
|
||||
/*case '\\':*/
|
||||
@ -134,6 +145,7 @@ mc_search__translate_replace_glob_to_regex (gchar *str)
|
||||
break;
|
||||
}
|
||||
g_string_append_c (buff, c);
|
||||
escaped_mode = FALSE;
|
||||
}
|
||||
return buff;
|
||||
}
|
||||
|
@ -39,7 +39,7 @@
|
||||
|
||||
static const char ESCAPE_SHELL_CHARS[] = " !#$%()&{}[]`?|<>;*\\\"'";
|
||||
static const char ESCAPE_REGEX_CHARS[] = "^!#$%()&{}[]`?|<>;*.\\";
|
||||
static const char ESCAPE_GLOB_CHARS[] = "$*\\";
|
||||
static const char ESCAPE_GLOB_CHARS[] = "$*\\?";
|
||||
|
||||
/*** file scope functions ************************************************************************/
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user