mirror of
https://sourceware.org/git/glibc.git
synced 2024-11-21 12:30:06 +00:00
mach: Fix __xpg_strerror_r on in-range but undefined errors [BZ #32350]
For instance, 1073741906 leads to system 16, subsystem 0 and code 82, which is in range (max_code is 122), but not defined. Return EINVAL in that case, like
This commit is contained in:
parent
6754b5becf
commit
d2e65aa7d6
@ -62,9 +62,19 @@ __xpg_strerror_r (int errnum, char *buf, size_t buflen)
|
|||||||
if (sub >= es->max_sub)
|
if (sub >= es->max_sub)
|
||||||
estr = (const char *) es->bad_sub;
|
estr = (const char *) es->bad_sub;
|
||||||
else if (code >= es->subsystem[sub].max_code)
|
else if (code >= es->subsystem[sub].max_code)
|
||||||
return EINVAL;
|
{
|
||||||
|
__snprintf (buf, buflen, "%s%d", _("Unknown error code: "), code);
|
||||||
|
return EINVAL;
|
||||||
|
}
|
||||||
else
|
else
|
||||||
estr = (const char *) _(es->subsystem[sub].codes[code]);
|
{
|
||||||
|
estr = (const char *) _(es->subsystem[sub].codes[code]);
|
||||||
|
if (estr == NULL)
|
||||||
|
{
|
||||||
|
__snprintf (buf, buflen, "%s%d", _("Unknown error code: "), code);
|
||||||
|
return EINVAL;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
size_t estrlen = strlen (estr);
|
size_t estrlen = strlen (estr);
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user