Skip to content
Permalink
Browse files Browse the repository at this point in the history
Fix vtrnd pci_vtrnd_notify uninitialized memory use (GHSL-2021-056)
Signed-off-by: Frederic Dalleau <frederic.dalleau@docker.com>
  • Loading branch information
fredericdalleau committed Jun 24, 2021
1 parent 451558f commit 41272a9
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions src/lib/pci_virtio_rnd.c
Expand Up @@ -100,7 +100,7 @@ pci_vtrnd_notify(void *vsc, struct vqueue_info *vq)
{
struct iovec iov;
struct pci_vtrnd_softc *sc;
int len;
int len, n;
uint16_t idx;

sc = vsc;
Expand All @@ -111,7 +111,11 @@ pci_vtrnd_notify(void *vsc, struct vqueue_info *vq)
}

while (vq_has_descs(vq)) {
vq_getchain(vq, &idx, &iov, 1, NULL);
n = vq_getchain(vq, &idx, &iov, 1, NULL);
if (n < 0) {
fprintf(stderr, "vtrnd: vtrnd_notify(): n %d\r\n", n);
return;
}

len = (int) read(sc->vrsc_fd, iov.iov_base, iov.iov_len);

Expand Down

0 comments on commit 41272a9

Please sign in to comment.