1101. [bug] Array bounds read error in lwres_gai_strerror.

This commit is contained in:
Mark Andrews
2001-11-02 00:48:06 +00:00
parent 785d1541b6
commit 552a117791
2 changed files with 5 additions and 2 deletions

View File

@@ -1,3 +1,5 @@
1101. [bug] Array bounds read error in lwres_gai_strerror.
1100. [bug] libbind: DNSSEC key ids were computed incorrectly.
1099. [cleanup] libbind: defining REPORT_ERRORS in lib/bind/dst caused

View File

@@ -15,7 +15,7 @@
* WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
/* $Id: gai_strerror.c,v 1.14 2001/05/29 22:40:10 bwelling Exp $ */
/* $Id: gai_strerror.c,v 1.15 2001/11/02 00:48:06 marka Exp $ */
#include <lwres/netdb.h>
@@ -43,7 +43,8 @@ lwres_gai_strerror(int ecode) {
char *deconst_ptr;
} ptr;
if ((ecode < 0) || (ecode > EAI_MAX))
if ((ecode < 0) ||
(ecode >= (int)(sizeof(gai_messages)/sizeof(*gai_messages))))
ptr.const_ptr = "invalid error code";
else
ptr.const_ptr = gai_messages[ecode];