1 --- bootp-2.4.3/bootpd.c.old Wed May 13 11:31:49 1998
2 +++ bootp-2.4.3/bootpd.c Wed May 13 11:34:07 1998
5 char *homedir, *bootfile;
9 /* XXX - SLIP init: Set bp_ciaddr = recv_addr here? */
12 * The "real" path is as seen by the BOOTP daemon on this
13 * machine, while the client path is relative to the TFTP
14 * daemon chroot directory (i.e. /tftpboot).
16 + * The bootfile might not be properly zero terminated. We
17 + * need to play safe - AC
19 if (hp->flags.tftpdir) {
20 + lpos=strlen(hp->tftpdir->string);
21 + if(lpos>=sizeof(realpath)-1)
23 strcpy(realpath, hp->tftpdir->string);
24 - clntpath = &realpath[strlen(realpath)];
25 + clntpath = &realpath[lpos];
35 if (homedir[0] != '/')
36 strcat(clntpath, "/");
37 + lpos+=strlen(homedir);
38 + if(lpos>=sizeof(realpath))
40 strcat(clntpath, homedir);
44 if (bootfile[0] != '/')
45 strcat(clntpath, "/");
46 + lpos+=strlen(bootfile);
47 + if(lpos>=sizeof(realpath))
49 strcat(clntpath, bootfile);
53 * First try to find the file with a ".host" suffix
56 - strcat(clntpath, ".");
57 - strcat(clntpath, hp->hostname->string);
60 + * Don't test if it wont fit.
62 + if(n+1+strlen(hp->hostname->string)<sizeof(realpath))
64 + strcat(clntpath, ".");
65 + strcat(clntpath, hp->hostname->string);
67 if (chk_access(realpath, &bootsize) < 0) {
68 clntpath[n] = 0; /* Try it without the suffix */
69 if (chk_access(realpath, &bootsize) < 0) {