]> err.no Git - util-linux/commitdiff
libmount: fix merge_optstr (do not truncate 3 trailing characters)
authorPetr Uzel <petr.uzel@centrum.cz>
Sun, 4 Jul 2010 18:02:57 +0000 (20:02 +0200)
committerKarel Zak <kzak@redhat.com>
Wed, 7 Jul 2010 08:06:16 +0000 (10:06 +0200)
I believe this is the correct fix.

Signed-off-by: Petr Uzel <petr.uzel@centrum.cz>
shlibs/mount/src/tab_parse.c

index 5dbcfa673ba9f6034e6e2936caa8d9259ec573e5..680e1fc18818d9ebe430eb3e2266afb6642dace8 100644 (file)
@@ -254,7 +254,8 @@ static char *merge_optstr(const char *vfs, const char *fs)
        if (!strcmp(vfs, fs))
                return strdup(vfs);             /* e.g. "aaa" and "aaa" */
 
-       sz = strlen(vfs) + strlen(fs) + 2;
+       /* leave space for leading "r[ow],", "," and trailing zero */
+       sz = strlen(vfs) + strlen(fs) + 5;
        res = malloc(sz);
        if (!res)
                return NULL;