To: vim-dev@vim.org Subject: Patch 6.0.018 Fcc: outbox From: Bram Moolenaar MIME-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 8bit ------------ Patch 6.0.018 Problem: Initializing 'encoding' may cause a crash when setlocale() is not used. (Dany St-Amant) Solution: Check for a NULL pointer. Files: src/mbyte.c *** ../vim60.17/src/mbyte.c Wed Sep 26 16:18:24 2001 --- src/mbyte.c Sun Oct 21 12:39:21 2001 *************** *** 2317,2324 **** #endif /* ! * Return the default value for 'encoding' in an allocated string. ! * Returns NULL when out of memory or no usable default could be found. */ int enc_default() --- 2317,2324 ---- #endif /* ! * Set the default value for 'encoding' (p_enc). ! * Returns OK when successful, FAIL when not. */ int enc_default() *************** *** 2349,2354 **** --- 2349,2357 ---- if ((s = getenv("LC_ALL")) == NULL || *s == NUL) if ((s = getenv("LC_CTYPE")) == NULL || *s == NUL) s = getenv("LANG"); + + if (s == NULL || *s == NUL) + return FAIL; /* The most generic locale format is: * language[_territory][.codeset][@modifier][+special][,[sponsor][_revision]] *** ../vim60.17/src/version.c Sun Oct 21 12:38:02 2001 --- src/version.c Sun Oct 21 12:35:28 2001 *************** *** 608,609 **** --- 608,611 ---- { /* Add new patch number below this line */ + /**/ + 18, /**/ -- hundred-and-one symptoms of being an internet addict: 139. You down your lunch in five minutes, at your desk, so you can spend the rest of the hour surfing the Net. /// Bram Moolenaar -- Bram@moolenaar.net -- http://www.moolenaar.net \\\ ((( Creator of Vim -- http://vim.sf.net -- ftp://ftp.vim.org/pub/vim ))) \\\ Help me helping AIDS orphans in Uganda - http://iccf-holland.org ///