From: Karel Zak Date: Fri, 19 Nov 2010 12:15:19 +0000 (+0100) Subject: libmount: fix mnt_optstr_remove_option_at() X-Git-Url: https://err.no/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=e548d51d552f2818064e218809a7ac00e89b6f39;p=util-linux libmount: fix mnt_optstr_remove_option_at() Signed-off-by: Karel Zak --- 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';