diff --git a/utils/magiedit/main.c b/utils/magiedit/main.c index 3c06720..5ac26eb 100644 --- a/utils/magiedit/main.c +++ b/utils/magiedit/main.c @@ -990,7 +990,7 @@ int main(int argc, char **argv) quote_lines = (char **)realloc(quote_lines, sizeof(char *) * (quote_line_count + 1)); } 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); strncpy(buffer, &unwrapped_quote[start_line], 74); 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; last_space = i+1; } 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); strncpy(buffer, &unwrapped_quote[start_line], last_space - start_line + 1); sprintf(quote_lines[quote_line_count], " %c> %s", msgto[0], buffer); @@ -1013,9 +1013,9 @@ int main(int argc, char **argv) } else { 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); - 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); j = 0; start_line = i+1;