Revision 49e40b66

b/hw/multiboot.c
97 97

  
98 98
static uint32_t mb_add_cmdline(MultibootState *s, const char *cmdline)
99 99
{
100
    int len = strlen(cmdline) + 1;
101 100
    target_phys_addr_t p = s->offset_cmdlines;
101
    char *b = (char *)s->mb_buf + p;
102 102

  
103
    pstrcpy((char *)s->mb_buf + p, len, cmdline);
104
    s->offset_cmdlines += len;
103
    get_opt_value(b, strlen(cmdline) + 1, cmdline);
104
    s->offset_cmdlines += strlen(b) + 1;
105 105
    return s->mb_buf_phys + p;
106 106
}
107 107

  
......
238 238
        const char *r = initrd_filename;
239 239
        mbs.mb_buf_size += strlen(r) + 1;
240 240
        mbs.mb_mods_avail = 1;
241
        while ((r = strchr(r, ','))) {
241
        while (*(r = get_opt_value(NULL, 0, r))) {
242 242
           mbs.mb_mods_avail++;
243 243
           r++;
244 244
        }
......
252 252
    mbs.offset_cmdlines = mbs.offset_mbinfo + mbs.mb_mods_avail * MB_MOD_SIZE;
253 253

  
254 254
    if (initrd_filename) {
255
        char *next_initrd;
255
        char *next_initrd, not_last;
256 256

  
257 257
        mbs.offset_mods = mbs.mb_buf_size;
258 258

  
......
261 261
            int mb_mod_length;
262 262
            uint32_t offs = mbs.mb_buf_size;
263 263

  
264
            next_initrd = strchr(initrd_filename, ',');
265
            if (next_initrd)
266
                *next_initrd = '\0';
264
            next_initrd = (char *)get_opt_value(NULL, 0, initrd_filename);
265
            not_last = *next_initrd;
266
            *next_initrd = '\0';
267 267
            /* if a space comes after the module filename, treat everything
268 268
               after that as parameters */
269 269
            target_phys_addr_t c = mb_add_cmdline(&mbs, initrd_filename);
......
287 287
                     (char *)mbs.mb_buf + offs,
288 288
                     (char *)mbs.mb_buf + offs + mb_mod_length, c);
289 289
            initrd_filename = next_initrd+1;
290
        } while (next_initrd);
290
        } while (not_last);
291 291
    }
292 292

  
293 293
    /* Commandline support */

Also available in: Unified diff