It is perhaps not the best idea to read behind the end of the boot_device string. It would be safer to declare boot_device as 'static char boot_device[4]' and use a strncpy.
Bernhard > diff --git a/hw/pc.c b/hw/pc.c > index a0c824f..3c552ff 100644 > --- a/hw/pc.c > +++ b/hw/pc.c > + /* set boot devices, and disable floppy signature check if requested */ > + rtc_set_memory(s, 0x3d, > + boot_device2nible(boot_device[1]) << 4 | > + boot_device2nible(boot_device[0]) ); > + rtc_set_memory(s, 0x38, > + boot_device2nible(boot_device[2]) << 4 | (fd_bootchk ? 0x0 : > 0x1)); > > /* floppy type */ > diff --git a/vl.c b/vl.c > index 6d8fe35..be0e06a 100644 > --- a/vl.c > +++ b/vl.c > + if (strlen(optarg) > 3) { > + fprintf(stderr, "qemu: too many boot devices\n"); > + exit(1); > + } > + boot_device = strdup(optarg); > + if (!strchr(boot_device, 'a') &&