aboutsummaryrefslogtreecommitdiff
path: root/src/crystfel_gui.c
diff options
context:
space:
mode:
authorThomas White <taw@physics.org>2021-03-01 10:57:04 +0100
committerThomas White <taw@physics.org>2021-03-01 10:57:04 +0100
commitef3ad92127e7158de7ab317b6e2f6408562a32f9 (patch)
tree5bbd9a02a387d312cc6b8f5ced1ae609548ecb98 /src/crystfel_gui.c
parent343afa679e424ce8513ed6156821b65026ad50e2 (diff)
GUI: Reject job names containing path separators
Diffstat (limited to 'src/crystfel_gui.c')
-rw-r--r--src/crystfel_gui.c13
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;