wok diff syslinux/stuff/iso2exe/boot.c @ rev 16002

syslinux/iso2exe: fix 16M hole
author Pascal Bellard <pascal.bellard@slitaz.org>
date Tue Mar 04 09:23:30 2014 +0000 (2014-03-04)
parents 19258b949c1b
children 3bb29e042c1c
line diff
     1.1 --- a/syslinux/stuff/iso2exe/boot.c	Thu Apr 04 11:19:19 2013 +0200
     1.2 +++ b/syslinux/stuff/iso2exe/boot.c	Tue Mar 04 09:23:30 2014 +0000
     1.3 @@ -25,7 +25,7 @@
     1.4  static void bootiso(char **iso)
     1.5  {
     1.6  	char *init = "rdinit=/init.exe", *mode="menu";
     1.7 -	char c, *s, rootfs[16], cmdline[256];
     1.8 +	char c, rootfs[16], cmdline[256];
     1.9  	int fd, restart;
    1.10  	unsigned long magic;
    1.11  	
    1.12 @@ -33,9 +33,10 @@
    1.13  	if (iso[1] && !strcmp(mode = iso[1], "text"))
    1.14  		init = "";
    1.15  	for (c = 0, restart = 1; isoreaddir(restart) == 0; restart = 0) {
    1.16 -		if (strncmp(isofilename, "rootfs", 6) || c > s[6]) continue;
    1.17 +		if (strncmp(isofilename, "rootfs", 6) 
    1.18 +			|| c > isofilename[6]) continue;
    1.19  		strcpy(rootfs, isofilename);
    1.20 -		c = s[6];
    1.21 +		c = isofilename[6];
    1.22  	}
    1.23  	if (isoopen(mode))
    1.24  		isoopen("bzImage");
    1.25 @@ -69,6 +70,11 @@
    1.26  static char *iso;
    1.27  static int fakeopen(char *file)
    1.28  {
    1.29 +	if (file) {
    1.30 +		char *s = file;
    1.31 +		while (*s && *s != '\r' && *s != '\n') s++;
    1.32 +		*s = 0;
    1.33 +	}
    1.34  	if (iso) {
    1.35  		isoreset(iso);
    1.36  		return isoopen(file);
    1.37 @@ -141,6 +147,12 @@
    1.38  		while (*s && *s != ' ') s++;
    1.39  		*s = 0;
    1.40  	}
    1.41 +	if (cmdline) {
    1.42 +		char *last;
    1.43 +		for (s = cmdline; *s && *s != '\r' && *s != '\n'; s++)
    1.44 +			if (*s != ' ') last = s;
    1.45 +		*++last = 0;
    1.46 +	}
    1.47  	if (fakeopen(kernel) == -1)
    1.48  		usage(argv[0]);
    1.49  	loadkernel();