|
|
commit f75f05e7b7235a75db161b6a4bd5ee07450c6034
Author: ManoloFLTK <41016272+ManoloFLTK@users.noreply.github.com>
AuthorDate: Tue Jan 31 15:37:33 2023 +0100
Commit: ManoloFLTK <41016272+ManoloFLTK@users.noreply.github.com>
CommitDate: Tue Jan 31 15:37:33 2023 +0100
Fix crash in Zenity filechooser with badly formed filter (#665)
src/Fl_Native_File_Chooser_Kdialog.cxx | 2 ++
1 file changed, 2 insertions(+)
diff --git src/Fl_Native_File_Chooser_Kdialog.cxx src/Fl_Native_File_Chooser_Kdialog.cxx
index db17d15..6fc27f1 100644
--- src/Fl_Native_File_Chooser_Kdialog.cxx
+++ src/Fl_Native_File_Chooser_Kdialog.cxx
@@ -208,6 +208,7 @@ char *Fl_Kdialog_Native_File_Chooser_Driver::parse_filter(const char *f) {
char *lead = new char[r-p];
memcpy(lead, p+1, (r-p)-1); lead[(r-p)-1] = 0;
const char *r2 = strchr(r, '}');
+ if (!r2) return NULL;
char *ends = new char[r2-r];
memcpy(ends, r+1, (r2-r)-1); ends[(r2-r)-1] = 0;
char *ptr;
@@ -248,6 +249,7 @@ void Fl_Kdialog_Native_File_Chooser_Driver::filter(const char *f) {
char *part = strtok_r(f2, "\n", &ptr);
while (part) {
char *p = parse_filter(part);
+ if (!p) break;
_parsedfilt = strapp(_parsedfilt, p);
_parsedfilt = strapp(_parsedfilt, "\n");
delete[] p;
[ Direct Link to Message ] | |
|
| |