Check errorcode > 0 in regerror().

This commit is contained in:
Philip.Hazel 2015-11-11 17:52:11 +00:00
parent ab48e8bb73
commit ccfd31cda2
2 changed files with 3 additions and 1 deletions

View File

@ -286,6 +286,8 @@ a factor of the size of the compiling workspace (it currently is).
83. Lock out configuring for EBCDIC with non-8-bit libraries.
84. Test for error code <= 0 in regerror().
Version 10.20 30-June-2015
--------------------------

View File

@ -147,7 +147,7 @@ regerror(int errcode, const regex_t *preg, char *errbuf, size_t errbuf_size)
int used;
const char *message;
message = (errcode >= (int)(sizeof(pstring)/sizeof(char *)))?
message = (errcode <= 0 || errcode >= (int)(sizeof(pstring)/sizeof(char *)))?
"unknown error code" : pstring[errcode];
if (preg != NULL && (int)preg->re_erroffset != -1)