From f8b5521cc615eeac897110ee13a44f49d63a21d9 Mon Sep 17 00:00:00 2001 From: John Darrington Date: Tue, 12 May 2009 07:18:31 +0800 Subject: [PATCH] Prevent invalid variable widths in variable sheet. --- src/ui/gui/psppire-var-store.c | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/src/ui/gui/psppire-var-store.c b/src/ui/gui/psppire-var-store.c index 8c400890..aadc5855 100644 --- a/src/ui/gui/psppire-var-store.c +++ b/src/ui/gui/psppire-var-store.c @@ -484,10 +484,19 @@ psppire_var_store_set_string (PsppireSheetModel *model, break; case PSPPIRE_VAR_STORE_COL_WIDTH: { - int width = atoi (text); - if ( ! text) return FALSE; + const int width = atoi (text); + if ( ! text) + return FALSE; + + if (width < 0) + return FALSE; + if ( var_is_alpha (pv)) + { + if ( width > MAX_STRING ) + return FALSE; var_set_width (pv, width); + } else { bool for_input -- 2.30.2