Coverity CID 1442: Update the table, and use the table size instead of

hard-coded constant; fixes static buffer overflow.
This commit is contained in:
christos 2006-05-24 23:51:39 +00:00
parent 4f8217f507
commit d62ef54061
1 changed files with 5 additions and 2 deletions

View File

@ -27,7 +27,7 @@
* q932_fac.c - decode Q.932 facilities
* ------------------------------------
*
* $Id: q932_fac.c,v 1.2 2003/10/06 09:43:28 itojun Exp $
* $Id: q932_fac.c,v 1.3 2006/05/24 23:51:39 christos Exp $
*
* $FreeBSD$
*
@ -394,11 +394,14 @@ static char *uni_str(int code)
"TELETEX STRING",
"ISO646 STRING",
"IA5 STRING",
"U TIME",
"G TIME",
"GRAPHIC STRING",
"VISUAL STRING",
"GENERAL STRING"
};
if (code >= 1 && code <= FAC_CODEUNI_GNSTR)
if (code >= 1 && code <= sizeof(tbl) / sizeof(tbl[0]))
return(tbl[code-1]);
else
return("ERROR, Value out of Range!");