diff options
author | Karel Zak <kzak@redhat.com> | 2010-11-19 13:15:19 +0100 |
---|---|---|
committer | Karel Zak <kzak@redhat.com> | 2011-01-03 12:28:46 +0100 |
commit | e548d51d552f2818064e218809a7ac00e89b6f39 (patch) | |
tree | 099efc17052c3cfd864aed655b22ee1d14c05f18 | |
parent | 97e23b5e5eae8a8d5e14b263bb150e62073d453f (diff) | |
download | util-linux-old-e548d51d552f2818064e218809a7ac00e89b6f39.tar.gz |
libmount: fix mnt_optstr_remove_option_at()
Signed-off-by: Karel Zak <kzak@redhat.com>
-rw-r--r-- | shlibs/mount/src/optstr.c | 4 |
1 files changed, 3 insertions, 1 deletions
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'; |