Fix segfault.
[pspp] / src / language / lexer / format-parser.c
index b3ccba55ced7b4d559966817c438b878ce87a1f8..b539432eb1d9b457773d80fca2803851cc254170 100644 (file)
    02110-1301, USA. */
 
 #include <config.h>
-#include "format.h"
+#include <data/format.h>
 #include <ctype.h>
-#include "message.h"
+#include <libpspp/message.h>
 #include <stdlib.h>
-#include "message.h"
+#include <libpspp/message.h>
 #include "lexer.h"
-#include "misc.h"
-#include "str.h"
-#include "variable.h"
+#include <libpspp/misc.h>
+#include <libpspp/str.h>
+#include <data/variable.h>
 
 #include "gettext.h"
 #define _(msgid) gettext (msgid)
@@ -128,6 +128,11 @@ parse_format_specifier (struct fmt_spec *input, enum fmt_parse_flags flags)
              ds_c_str (&tokstr));
       return 0;
     }
+  if ( w > MAX_STRING )
+    {
+      msg (SE, _("String variable width may not exceed %d"), MAX_STRING);
+      return 0;
+    }
 
   cp = cp2;
   if (f->n_args > 1 && *cp == '.')