David O'Brien schrieb:
On Mon, Jan 12, 2009 at 10:44:25AM +0100, Christoph Mallon wrote:
David O'Brien schrieb:
On Sun, Jan 11, 2009 at 08:56:22AM +0100, Christoph Mallon wrote:
David O'Brien schrieb:
On Sun, Jan 04, 2009 at 07:06:18PM +0100, Christoph Mallon wrote:
I'm pretty sure $SUPERNATURAL_BEING_OF_YOUR_CHOICE killed a kitten for the ugly hack you added to mount. The moment you overflow a buffer, you are in no man's land and there's no escape. I appended a patch, which solves this issue once and for all: The argv array gets dynamically expanded, when its limit is reached.
Please - for all kittens out there - commit this patch.
Hi Christoph,
Unfortunately your patch doesn't work.
For a 'ufs' file system listed in /etc/fstab
    $ umount /foo
    $ mount /foo
Does not work.
Why haven't you told me earlier?
Wow, wish I did have the gift to know something before I know something.
Especially tomorrow's lotto #'s. ;-)
I sent you my patch almost a week before you commited your changes. I think, there was enough time to tell me, that my patch had a flaw.

Christoph when I work for you for $$, then you can be demanding on when
I read email and test the attached patches.  Since this is in my free
time...

I've attached a corrected version of my patch, which has a mnt_argc = 0; added in order to reset the argument vector on reentry of mountfs() (instead of appending to the arguments of the last round).

If you want me to read your patches - stop making larger changes than
necessary - that primarily undo the changes I've already done.  Instead
send patches that fix bugs you find in smaller ways (unless that's not
possible).

thanks,

David, when I work for you for €€, then you can be demanding on how I write patches to suit your taste. Since this is in my free time...

Instead, to show that I'm not resentful and in case you didn't fully read my last email, here's a last piece of free advice: You broke HEAD in r187093. So take the attached patch and run with it.

You're welcome
Index: mount.c
===================================================================
--- mount.c     (Revision 187093)
+++ mount.c     (Arbeitskopie)
@@ -70,6 +70,7 @@
 
 struct cpa {
        char    **a;
+       int     sz;
        int     c;
 };
 
@@ -503,11 +504,9 @@
 static void
 append_arg(struct cpa *sa, char *arg)
 {
-       static int a_sz;
-
-       if (sa->c + 1 == a_sz) {
-               a_sz = a_sz == 0 ? 8 : a_sz * 2;
-               sa->a = realloc(sa->a, sizeof(sa->a) * a_sz);
+       if (sa->c + 1 == sa->sz) {
+               sa->sz = sa->sz == 0 ? 8 : sa->sz * 2;
+               sa->a = realloc(sa->a, sizeof(sa->a) * sa->sz);
                if (sa->a == NULL)
                        errx(1, "realloc failed");
        }
@@ -518,11 +517,10 @@
 mountfs(const char *vfstype, const char *spec, const char *name, int flags,
        const char *options, const char *mntopts)
 {
-       struct cpa mnt_argv;
+       static struct cpa mnt_argv;
        struct statfs sf;
        int i, ret;
        char *optbuf, execname[PATH_MAX], mntpath[PATH_MAX];
-       static int mnt_argv_inited;
 
        /* resolve the mountpoint with realpath(3) */
        (void)checkpath(name, mntpath);
@@ -557,10 +555,6 @@
        /* Construct the name of the appropriate mount command */
        (void)snprintf(execname, sizeof(execname), "mount_%s", vfstype);
 
-       if (!mnt_argv_inited) {
-               mnt_argv_inited++;
-               mnt_argv.a = NULL;
-       }
        mnt_argv.c = -1;
        append_arg(&mnt_argv, execname);
        mangle(optbuf, &mnt_argv);
_______________________________________________
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"

Reply via email to