[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: cvs commit to boot-floppies/utilities/dbootstrap by aph



On Mon, Apr 09, 2001 at 10:20:37PM -0700, aph@debian.org wrote:
> Repository: boot-floppies/utilities/dbootstrap
> who:        aph
> time:       Mon Apr  9 22:20:37 PDT 2001
> 
> 
> Log Message:
> 
> fix a typo bug in Matt's code, and comment that I don't really get it
> 
> 
> Files:
> 
> changed:    bootconfig.c

Argh.  Looking over my code, there are a couple more issues.
The following patch fixes a buffer overrun, adds in a comment as
to what we are doing, reads the correct symbolic link, and keeps
it around in case we are run multiple times.

Matt

Index: utilities/dbootstrap/bootconfig.c
===================================================================
RCS file: /cvs/debian-boot/boot-floppies/utilities/dbootstrap/bootconfig.c,v
retrieving revision 1.88
diff -u -r1.88 bootconfig.c
--- utilities/dbootstrap/bootconfig.c	2001/04/10 05:20:37	1.88
+++ utilities/dbootstrap/bootconfig.c	2001/04/10 06:21:57
@@ -514,17 +514,14 @@
   fprintf(filep,"root=%s\n",Root->name);
   fprintf(filep,"timeout=100\n");
   /* This is where it gets tricky */
-				/* Adam: un, I don't understand this
-                                   code, please document why it's
-                                   necessary */
+  /* We need to create a symlink on the boot partition to the kernel image. */
   if (Boot != Root) {
       char buf[256], *p;
-      readlink("/target/boot/vmlinuz", buf, sizeof(buf));
-      buf[256] = '\0';
+      readlink("/target/vmlinuz", buf, sizeof(buf));
+      buf[255] = '\0';
       p = strrchr(buf, '/');
       if (p == NULL)
         p = buf;
-      unlink("/target/vmlinuz"); /* does us no good */
       unlink("/target/boot/vmlinuz"); /* make sure this is gone */
       symlink(p, "/target/boot/vmlinuz");
   }

Attachment: pgpRx4J60HtoO.pgp
Description: PGP signature


Reply to: