Add test for PERMISSIONS with bad syntax
[pspp] / src / language / utilities / permissions.c
index 904ba95b270e2a7de6c5a22e729f64b8b3247cf1..3f679c150e21968370c2b2d283fcdfb7145f4131 100644 (file)
@@ -51,9 +51,10 @@ cmd_permissions (struct lexer *lexer, struct dataset *ds UNUSED)
     lex_match (lexer, T_EQUALS);
 
   str = lex_tokcstr (lexer);
-  fn = strdup (str);
+  if (str)
+    fn = strdup (str);
 
-  if (!lex_force_match (lexer, T_STRING))
+  if (!lex_force_match (lexer, T_STRING) || str == NULL)
     goto error;
 
   lex_match (lexer, T_SLASH);