mirror of
https://git.hardenedbsd.org/hardenedbsd/HardenedBSD.git
synced 2024-11-23 20:01:08 +01:00
libc: Eliminate some relative relocations in fmtmsg().
This commit is contained in:
parent
fb53214d28
commit
8b34578da7
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=232007
@ -45,10 +45,6 @@ static const char
|
||||
*sevinfo(int);
|
||||
static int validmsgverb(const char *);
|
||||
|
||||
static const char *validlist[] = {
|
||||
"label", "severity", "text", "action", "tag", NULL
|
||||
};
|
||||
|
||||
int
|
||||
fmtmsg(long class, const char *label, int sev, const char *text,
|
||||
const char *action, const char *tag)
|
||||
@ -205,14 +201,18 @@ sevinfo(int sev)
|
||||
static int
|
||||
validmsgverb(const char *msgverb)
|
||||
{
|
||||
const char *validlist = "label\0severity\0text\0action\0tag\0";
|
||||
char *msgcomp;
|
||||
int i, equality;
|
||||
size_t len1, len2;
|
||||
const char *p;
|
||||
int equality;
|
||||
|
||||
equality = 0;
|
||||
while ((msgcomp = nextcomp(msgverb)) != NULL) {
|
||||
equality--;
|
||||
for (i = 0; validlist[i] != NULL; i++) {
|
||||
if (strcmp(msgcomp, validlist[i]) == 0)
|
||||
len1 = strlen(msgcomp);
|
||||
for (p = validlist; (len2 = strlen(p)) != 0; p += len2 + 1) {
|
||||
if (len1 == len2 && memcmp(msgcomp, p, len1) == 0)
|
||||
equality++;
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user