diff options
author | Thomas White <taw@physics.org> | 2021-03-01 10:57:04 +0100 |
---|---|---|
committer | Thomas White <taw@physics.org> | 2021-03-01 10:57:04 +0100 |
commit | ef3ad92127e7158de7ab317b6e2f6408562a32f9 (patch) | |
tree | 5bbd9a02a387d312cc6b8f5ced1ae609548ecb98 | |
parent | 343afa679e424ce8513ed6156821b65026ad50e2 (diff) |
GUI: Reject job names containing path separators
-rw-r--r-- | src/crystfel_gui.c | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/src/crystfel_gui.c b/src/crystfel_gui.c index cd69f494..1dda47aa 100644 --- a/src/crystfel_gui.c +++ b/src/crystfel_gui.c @@ -1107,6 +1107,14 @@ struct gui_job_notes_page *add_job_notes_page(GtkWidget *notebook) } +static int job_name_valid(const char *job_title) +{ + if ( strchr(job_title, '/') != NULL ) return 0; + if ( strchr(job_title, '\\') != NULL ) return 0; + return 1; +} + + GFile *make_job_folder(const char *job_title, const char *job_notes) { struct stat s; @@ -1117,6 +1125,11 @@ GFile *make_job_folder(const char *job_title, const char *job_notes) char *notes_path; FILE *fh; + if ( !job_name_valid(job_title) ) { + ERROR("Invalid job name '%s'\n", job_title); + return NULL; + } + workdir = strdup(job_title); if ( workdir == NULL ) return NULL; |