]> git.proxmox.com Git - qemu.git/commitdiff
ppc405_uc: fix a buffer overflow
authorBlue Swirl <blauwirbel@gmail.com>
Wed, 12 Jan 2011 21:12:31 +0000 (21:12 +0000)
committerBlue Swirl <blauwirbel@gmail.com>
Wed, 12 Jan 2011 21:12:31 +0000 (21:12 +0000)
Fix a buffer overflow, reported by cppcheck:
[/src/qemu/hw/ppc405_uc.c:72]: (error) Buffer access out-of-bounds: bd.bi_s_version

The use of field bi_s_version seems to be a typo, it should be
bi_r_version.

Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
hw/ppc405_uc.c

index 8136cb962ba0a2e8066829839b45f8b18b6a9aac..334187e53b4fb09b9a637e7a858254acdfb5d5e9 100644 (file)
@@ -68,8 +68,9 @@ ram_addr_t ppc405_set_bootinfo (CPUState *env, ppc4xx_bd_info_t *bd,
     stl_phys(bdloc + 0x34, bd->bi_baudrate);
     for (i = 0; i < 4; i++)
         stb_phys(bdloc + 0x38 + i, bd->bi_s_version[i]);
-    for (i = 0; i < 32; i++)
-        stb_phys(bdloc + 0x3C + i, bd->bi_s_version[i]);
+    for (i = 0; i < 32; i++) {
+        stb_phys(bdloc + 0x3C + i, bd->bi_r_version[i]);
+    }
     stl_phys(bdloc + 0x5C, bd->bi_plb_busfreq);
     stl_phys(bdloc + 0x60, bd->bi_pci_busfreq);
     for (i = 0; i < 6; i++)