while thinking about mirlibₘᵢₙc I figured that sys_errlist[] entries may be NULL

This commit is contained in:
tg
2013-01-01 03:32:44 +00:00
parent 23325a3355
commit 0700d45ce6
3 changed files with 7 additions and 7 deletions

4
shf.c
View File

@ -24,7 +24,7 @@
#include "sh.h"
__RCSID("$MirOS: src/bin/mksh/shf.c,v 1.55 2012/12/28 03:20:35 tg Exp $");
__RCSID("$MirOS: src/bin/mksh/shf.c,v 1.56 2013/01/01 03:32:44 tg Exp $");
/* flags to shf_emptybuf() */
#define EB_READSW 0x01 /* about to switch to reading */
@ -1102,7 +1102,7 @@ cstrerror(int errnum)
static char errbuf[15 + 1 + (8 * sizeof(int) + 2) / 3 + 1];
#if HAVE_SYS_ERRLIST
if (errnum > 0 && errnum < sys_nerr)
if (errnum > 0 && errnum < sys_nerr && sys_errlist[errnum])
return (sys_errlist[errnum]);
#endif