From: John Darrington Date: Mon, 11 May 2009 23:18:31 +0000 (+0800) Subject: Prevent invalid variable widths in variable sheet. X-Git-Tag: v0.7.3~81 X-Git-Url: https://pintos-os.org/cgi-bin/gitweb.cgi?p=pspp-builds.git;a=commitdiff_plain;h=f8b5521cc615eeac897110ee13a44f49d63a21d9 Prevent invalid variable widths in variable sheet. --- 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