diff --git a/src/dll/fuse/fuse_opt.c b/src/dll/fuse/fuse_opt.c index 43684e6b..c8961545 100644 --- a/src/dll/fuse/fuse_opt.c +++ b/src/dll/fuse/fuse_opt.c @@ -495,22 +495,24 @@ static int fsp_fuse_opt_add_opt_internal(char **opts, const char *opt, int escap newopts = memalloc(optsize + optlen + 1); if (0 == newopts) return -1; - memfree(*opts); - *opts = newopts; if (0 != optsize) { memcpy(newopts, *opts, optsize - 1); newopts[optsize - 1] = ','; - newopts += optsize; } + memfree(*opts); + *opts = newopts; + newopts += optsize; + for (p = opt; *p; p++, newopts++) { if (escaped && (',' == *p || '\\' == *p)) *newopts++ = '\\'; *newopts = *p; } + *newopts = '\0'; return 0; }