From e548d51d552f2818064e218809a7ac00e89b6f39 Mon Sep 17 00:00:00 2001 From: Karel Zak Date: Fri, 19 Nov 2010 13:15:19 +0100 Subject: [PATCH] libmount: fix mnt_optstr_remove_option_at() Signed-off-by: Karel Zak --- shlibs/mount/src/optstr.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/shlibs/mount/src/optstr.c b/shlibs/mount/src/optstr.c index 5e544658..c5c7c221 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'; -- 2.39.5