[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-devel] [PATCHv2] multiboot: copy the cmdline verbatim, unescap
From: |
Paolo Bonzini |
Subject: |
Re: [Qemu-devel] [PATCHv2] multiboot: copy the cmdline verbatim, unescape module strings |
Date: |
Thu, 15 Dec 2016 11:56:00 +0100 |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Thunderbird/45.5.1 |
On 15/12/2016 11:03, Vlad Lungu wrote:
>
> if (initrd_filename) {
> - char *next_initrd, not_last;
> + char *next_initrd, not_last, tmpbuf[strlen(initrd_filename) + 1];
>
> mbs.offset_mods = mbs.mb_buf_size;
>
> @@ -299,22 +299,24 @@ int load_multiboot(FWCfgState *fw_cfg,
> next_initrd = (char *)get_opt_value(NULL, 0, initrd_filename);
> not_last = *next_initrd;
> *next_initrd = '\0';
> + /* Unescape the filename + eventual arguments */
> + get_opt_value(tmpbuf, strlen(initrd_filename) + 1,
> initrd_filename);
No need to call get_opt_value twice; you can call it once since you have
declared tmpbuf to hold the entire size of initrd_filename.
Also, the second argument of get_opt_value can be sizeof(tmpbuf) or
ARRAY_SIZE(tmpbuf), as you prefer.
Paolo