- cygwin_conv_to_full_posix_path(av[2], posixpath);
- sprintf(buf, "lyxclient" PROGRAM_SUFFIX " %s '%s' %s",
- av[1], posixpath, av[3]);
+ char const * fmt = "lyxclient" PROGRAM_SUFFIX " %s '%s' %s";
+ convert_to_full_posix_path(av[2], posixpath);
+ bufsize = snprintf(0, 0, fmt, av[1], posixpath, av[3]) + 1;
+ if ((buf = malloc(bufsize)))
+ snprintf(buf, bufsize, fmt, av[1], posixpath, av[3]);
+ }
+
+ if (!buf) {
+ MessageBox(0, "Too long arguments", "lyxeditor", 0);
+ return 1;