[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-devel] [Patch] set boot sequence from command line
From: |
Bernhard Kauer |
Subject: |
Re: [Qemu-devel] [Patch] set boot sequence from command line |
Date: |
Thu, 25 Oct 2007 10:49:25 +0200 |
User-agent: |
Mutt/1.5.16 (2007-06-11) |
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') &&