summaryrefslogtreecommitdiffstats
path: root/shlibs/mount/src/optstr.c
diff options
context:
space:
mode:
authorKarel Zak2010-11-19 13:15:19 +0100
committerKarel Zak2011-01-03 12:28:46 +0100
commite548d51d552f2818064e218809a7ac00e89b6f39 (patch)
tree099efc17052c3cfd864aed655b22ee1d14c05f18 /shlibs/mount/src/optstr.c
parentlibmount: support /{proc,etc}/filesystems (diff)
downloadkernel-qcow2-util-linux-e548d51d552f2818064e218809a7ac00e89b6f39.tar.gz
kernel-qcow2-util-linux-e548d51d552f2818064e218809a7ac00e89b6f39.tar.xz
kernel-qcow2-util-linux-e548d51d552f2818064e218809a7ac00e89b6f39.zip
libmount: fix mnt_optstr_remove_option_at()
Signed-off-by: Karel Zak <kzak@redhat.com>
Diffstat (limited to 'shlibs/mount/src/optstr.c')
-rw-r--r--shlibs/mount/src/optstr.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/shlibs/mount/src/optstr.c b/shlibs/mount/src/optstr.c
index 5e5446589..c5c7c221a 100644
--- a/shlibs/mount/src/optstr.c
+++ b/shlibs/mount/src/optstr.c
@@ -297,7 +297,7 @@ int mnt_optstr_get_option(char *optstr, const char *name,
*/
int mnt_optstr_remove_option_at(char **optstr, char *begin, char *end)
{
- size_t sz = strlen(end);
+ size_t sz;
if (!optstr || !begin || !end)
return -EINVAL;
@@ -305,6 +305,8 @@ int mnt_optstr_remove_option_at(char **optstr, char *begin, char *end)
if ((begin == *optstr || *(begin - 1) == ',') && *end == ',')
end++;
+ sz = strlen(end);
+
memmove(begin, end, sz + 1);
if (!*begin && *(begin - 1) == ',')
*(begin - 1) = '\0';