ascii: Avoid buffer overread outputting page longer than allocated lines.
[pspp] / src / ui / gui / psppire-variable-sheet.c
index 35ee7d6085d636083ae072f99be88ce8654bb799..32d163f66578a579f16e33a6f9be5ba4fb091041 100644 (file)
@@ -305,6 +305,10 @@ change_var_property (PsppireVariableSheet *var_sheet, gint col, gint row, const
   PsppireDict *dict = NULL;
   g_object_get (var_sheet, "data-model", &dict, NULL);
 
+  int n_rows = psppire_dict_get_var_cnt (dict);
+  if (row > n_rows)
+    return;
+
   /* Return the IDXth variable */
   struct variable *var =  psppire_dict_get_variable (dict, row);