diff options
Diffstat (limited to 'src')
| -rw-r--r-- | src/Fl_Native_File_Chooser_WIN32.cxx | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/src/Fl_Native_File_Chooser_WIN32.cxx b/src/Fl_Native_File_Chooser_WIN32.cxx index 2d11d0e63..4eb03ae8a 100644 --- a/src/Fl_Native_File_Chooser_WIN32.cxx +++ b/src/Fl_Native_File_Chooser_WIN32.cxx @@ -834,7 +834,7 @@ static int count_filters(const char *filter) { // void Fl_WinAPI_Native_File_Chooser_Driver::parse_filter(const char *in) { clear_filters(); - if ( ! in ) return; + if ( ! in || in[0] == '\0' ) return; int has_name = strchr(in, '\t') ? 1 : 0; char mode = has_name ? 'n' : 'w'; // parse mode: n=name, w=wildcard @@ -842,9 +842,9 @@ void Fl_WinAPI_Native_File_Chooser_Driver::parse_filter(const char *in) { // whatever input string is, our output won't be much longer in length.. // use double length just for safety. size_t slen = strlen(in); - char *wildprefix = new char[slen*2]; wildprefix[0] = 0; - char *comp = new char[slen*2]; comp[0] = 0; - char *name = new char[slen*2]; name[0] = 0; + char *wildprefix = new char[(slen+1)*2]; wildprefix[0] = 0; + char *comp = new char[(slen+1)*2]; comp[0] = 0; + char *name = new char[(slen+1)*2]; name[0] = 0; // Init int nwildcards = 0; @@ -852,7 +852,7 @@ void Fl_WinAPI_Native_File_Chooser_Driver::parse_filter(const char *in) { char **wildcards = new char*[maxfilters]; // parsed wildcards (can be several) int t; for ( t=0; t<maxfilters; t++ ) { - wildcards[t] = new char[slen]; + wildcards[t] = new char[slen+1]; wildcards[t][0] = '\0'; } |
