Avoid calling memcpy() on NULL
base2bin() would call memcpy() on NULL for empty fsverity signatures. This is undefined behavior, even if the length is 0.
This commit is contained in:
parent
3a6b1d8fbf
commit
6d3ce1c968
|
@ -1613,8 +1613,10 @@ static uint8_t *base2bin(Header h, rpmTagVal tag, rpm_count_t num, int *len)
|
|||
t = bin = xcalloc(num, maxlen);
|
||||
|
||||
for (i = 0; i < num; i++) {
|
||||
memcpy(t, arr[i], lengths[i]);
|
||||
free(arr[i]);
|
||||
if (arr[i]) {
|
||||
memcpy(t, arr[i], lengths[i]);
|
||||
free(arr[i]);
|
||||
}
|
||||
t += maxlen;
|
||||
}
|
||||
*len = maxlen;
|
||||
|
|
Loading…
Reference in New Issue