12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182 |
- --- util-linux-2.23.2.orig/libmount/src/tab_parse.c 2013-07-30 10:39:26.000000000 +0200
- +++ util-linux-2.23.2/libmount/src/tab_parse.c 2013-08-14 11:39:26.000000000 +0200
- @@ -16,6 +16,8 @@
- #include <dirent.h>
- #include <fcntl.h>
-
- +#define UL_SCNsA "%ms"
- +
- #include "at.h"
- #include "mangle.h"
- #include "mountP.h"
- @@ -59,18 +61,21 @@ static int next_number(char **s, int *nu
- static int mnt_parse_table_line(struct libmnt_fs *fs, char *s)
- {
- int rc, n = 0, xrc;
- - char *src = NULL, *fstype = NULL, *optstr = NULL;
- + int len = strlen (s) + 1;
- + char *fstype = malloc (sizeof *fstype * len);
- + char *optstr = malloc (sizeof *optstr * len);
- + char *src = malloc (sizeof *src * len);
-
- - rc = sscanf(s, UL_SCNsA" "
- - UL_SCNsA" "
- - UL_SCNsA" "
- - UL_SCNsA" "
- + rc = sscanf(s, "%s"" "
- + "%s"" "
- + "%s"" "
- + "%s"" "
- "%n",
-
- - &src,
- - &fs->target,
- - &fstype,
- - &optstr,
- + src,
- + fs->target,
- + fstype,
- + optstr,
- &n);
- xrc = rc;
-
- @@ -135,13 +140,18 @@ static int mnt_parse_mountinfo_line(stru
- int rc, end = 0;
- unsigned int maj, min;
- char *fstype = NULL, *src = NULL, *p;
- + int len = strlen (s) + 1;
- +
- + fs->root = malloc (sizeof *fs->root * len);
- + fs->target = malloc (sizeof *fs->target * len);
- + fs->vfs_optstr = malloc (sizeof *fs->vfs_optstr * len);
-
- rc = sscanf(s, "%u "
- "%u "
- "%u:%u "
- - UL_SCNsA" "
- - UL_SCNsA" "
- - UL_SCNsA
- + "%s"" "
- + "%s"" "
- + "%s"
- "%n",
-
- &fs->id,
- @@ -164,10 +174,14 @@ static int mnt_parse_mountinfo_line(stru
- if (p > s + 1)
- fs->opt_fields = strndup(s + 1, p - s - 1);
- s = p + 3;
- + len = strlen (s) + 1;
- + fstype = malloc (sizeof *fstype * len);
- + src = malloc (sizeof *src * len);
- + fs->fs_optstr = malloc (sizeof *fs->fs_optstr * len);
-
- - rc += sscanf(s, UL_SCNsA" "
- - UL_SCNsA" "
- - UL_SCNsA,
- + rc += sscanf(s, "%s"" "
- + "%s"" "
- + "%s",
-
- &fstype,
- &src,
|