attempt to fix quoting

This commit is contained in:
Andrew Pamment 2017-09-10 22:53:18 +10:00
parent 2c0c548d4f
commit 4649fcfcd8

View File

@ -990,7 +990,7 @@ int main(int argc, char **argv)
quote_lines = (char **)realloc(quote_lines, sizeof(char *) * (quote_line_count + 1)); quote_lines = (char **)realloc(quote_lines, sizeof(char *) * (quote_line_count + 1));
} }
if (unwrapped_quote[i] == '\r' || unwrapped_quote[i] == ' ' || i - last_space > 71) { if (unwrapped_quote[i] == '\r' || unwrapped_quote[i] == ' ' || i - last_space > 71) {
quote_lines[quote_line_count] = (char *)malloc(i - start_line + 5); quote_lines[quote_line_count] = (char *)malloc(i - start_line + 6);
memset(buffer, 0, 256); memset(buffer, 0, 256);
strncpy(buffer, &unwrapped_quote[start_line], 74); strncpy(buffer, &unwrapped_quote[start_line], 74);
sprintf(quote_lines[quote_line_count], " %c> %s", msgto[0], buffer); sprintf(quote_lines[quote_line_count], " %c> %s", msgto[0], buffer);
@ -998,7 +998,7 @@ int main(int argc, char **argv)
start_line = i+1; start_line = i+1;
last_space = i+1; last_space = i+1;
} else { } else {
quote_lines[quote_line_count] = (char *)malloc(last_space - start_line + 5); quote_lines[quote_line_count] = (char *)malloc(last_space - start_line + 6);
memset(buffer, 0, 256); memset(buffer, 0, 256);
strncpy(buffer, &unwrapped_quote[start_line], last_space - start_line + 1); strncpy(buffer, &unwrapped_quote[start_line], last_space - start_line + 1);
sprintf(quote_lines[quote_line_count], " %c> %s", msgto[0], buffer); sprintf(quote_lines[quote_line_count], " %c> %s", msgto[0], buffer);
@ -1013,9 +1013,9 @@ int main(int argc, char **argv)
} else { } else {
quote_lines = (char **)realloc(quote_lines, sizeof(char *) * (quote_line_count + 1)); quote_lines = (char **)realloc(quote_lines, sizeof(char *) * (quote_line_count + 1));
} }
quote_lines[quote_line_count] = (char *)malloc(i - start_line + 5); quote_lines[quote_line_count] = (char *)malloc(i - start_line + 6);
memset(buffer, 0, 256); memset(buffer, 0, 256);
strncpy(buffer, &unwrapped_quote[start_line], j); strncpy(buffer, &unwrapped_quote[start_line], j + 1);
sprintf(quote_lines[quote_line_count], " %c> %s", msgto[0], buffer); sprintf(quote_lines[quote_line_count], " %c> %s", msgto[0], buffer);
j = 0; j = 0;
start_line = i+1; start_line = i+1;