From: Byrial Jensen Date: Sun, 18 Dec 2011 12:26:20 +0000 (+0100) Subject: Fix a possible crash in the file browser X-Git-Url: http://winboard.nl/cgi-bin?a=commitdiff_plain;h=7e695010e3a0d264b6532d00d9360e3f9fb09686;p=xboard.git Fix a possible crash in the file browser If the OK button was selected in the file browser when no file was selected there was a read out of bounds which could crash xboard --- diff --git a/filebrowser/selfile.c b/filebrowser/selfile.c index e6edfe4..729453b 100644 --- a/filebrowser/selfile.c +++ b/filebrowser/selfile.c @@ -883,7 +883,7 @@ XsraSelFile(toplevel, prompt, ok, cancel, failed, SFprepareToReturn(); return stderr; } - if ((*name_return)[strlen(*name_return)-1] != '/' && // [HGM] refuse directories + if ((!(*name_return)[0] || (*name_return)[strlen(*name_return)-1] != '/') && // [HGM] refuse directories (fp = SFopenFile(*name_return, mode, prompt, failed))) { SFprepareToReturn(); return fp;