On Thu, Nov 8, 2018 at 4:50 PM Tony Mechelynck <antoine.mechely...@gmail.com> wrote: > > On Thu, Nov 8, 2018 at 6:22 AM Nazri Ramliy <ayieh...@gmail.com> wrote: > > > > On Tue, Nov 6, 2018 at 3:26 AM Bram Moolenaar <b...@moolenaar.net> wrote: > > > + static int > > > + is_valid_mess_lang(char_u *lang) > > > + { > > > + return lang != NULL && ASCII_ISALPHA(lang[0]) && > > > ASCII_ISALPHA(lang[1]); > > > > Any chance of segfault due to strlen(lang) < 1 here? > > > > nazri > > IIUC, lang is an ASCIIZ string; hence, if strleng(lang) == 0 then > either lang == NULL or lang[0] == 0 (which is not ASCII_ISALPHA) and > shortcut evaluation should prevent looking at lang[1].
Ah.. Good old C... terse and efficient, and sharp! nazri -- -- You received this message from the "vim_dev" maillist. Do not top-post! Type your reply below the text you are replying to. For more information, visit http://www.vim.org/maillist.php --- You received this message because you are subscribed to the Google Groups "vim_dev" group. To unsubscribe from this group and stop receiving emails from it, send an email to vim_dev+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.