libctf: Don't construct pointers to out of bounds array offsets
Just attempting to do the pointer arithmetic is undefined behavior. No functional change intended. Reported by: Coverity Sponsored by: Dell EMC Isilon
This commit is contained in:
parent
e796cc77c5
commit
f5147e312f
@ -59,10 +59,12 @@ isqualifier(const char *s, size_t len)
|
||||
};
|
||||
|
||||
int h = s[len - 1] + (int)len - 105;
|
||||
const struct qual *qp = &qhash[h];
|
||||
const struct qual *qp;
|
||||
|
||||
return (h >= 0 && h < sizeof (qhash) / sizeof (qhash[0]) &&
|
||||
len == qp->q_len && strncmp(qp->q_name, s, qp->q_len) == 0);
|
||||
if (h < 0 || h >= sizeof (qhash) / sizeof (qhash[0]))
|
||||
return (0);
|
||||
qp = &qhash[h];
|
||||
return (len == qp->q_len && strncmp(qp->q_name, s, qp->q_len) == 0);
|
||||
}
|
||||
|
||||
/*
|
||||
|
Loading…
x
Reference in New Issue
Block a user