diff --git a/midilink b/midilink index bb09bbe..b8d23e3 100755 Binary files a/midilink and b/midilink differ diff --git a/misc.c b/misc.c index 29c8a9f..6856923 100644 --- a/misc.c +++ b/misc.c @@ -1054,11 +1054,30 @@ int misc_text_to_speech_sz(char * txt, size_t len) { if (misc_check_file("/media/fat/linux/pico2wave")) { - char fmt[] = "/media/fat/linux/pico2wave --wave=/tmp/txtout.wav %c%s%c;"; - char * tmp = malloc(len + sizeof(fmt)); + char cmd[] = "/media/fat/linux/pico2wave --wave=/tmp/txtout.wav \""; + char * c = strchr(txt, '"'); + size_t quoteCount = 1; + for (size_t src = 0; src < len; src++) + if (txt[src] == '"') + quoteCount++; + char * tmp = malloc(len + sizeof(cmd) + quoteCount); if(tmp) { - sprintf(tmp, fmt, '"', txt, '"'); + strcpy(tmp, cmd); + size_t dst = sizeof(cmd) -1; + //we need to encode the quotes.... \" + for(size_t src = 0;src < len; src++) + { + if (txt[src] != '"') + tmp[dst++] = txt[src]; + else + { + tmp[dst++] = '\\'; + tmp[dst++] = '\"'; + } + } + tmp[dst++] = '"'; + tmp[dst] = 0x00; //misc_make_file("/tmp/tst.txt", tmp); system(tmp); free(tmp); diff --git a/mlinkutil b/mlinkutil index c4c7b29..7e6509e 100755 Binary files a/mlinkutil and b/mlinkutil differ