diff --git a/src/http_template.c b/src/http_template.c index 012ed7a..b1d6c3a 100644 --- a/src/http_template.c +++ b/src/http_template.c @@ -145,7 +145,7 @@ char *c_simple_http_path_to_generated( size_t stored_html_size = strlen(stored_html) + 1; html_buf = malloc(stored_html_size); memcpy(html_buf, stored_html, stored_html_size); - html_buf_size = stored_html_size; + html_buf_size = stored_html_size - 1; } // At this point, html_buf contains the raw HTML as a C-string. diff --git a/src/test.c b/src/test.c index fb2cb0d..8aab8d8 100644 --- a/src/test.c +++ b/src/test.c @@ -254,7 +254,7 @@ int main(void) { char *buf = c_simple_http_path_to_generated("/", &config, &output_buf_size); ASSERT_TRUE(buf != NULL); ASSERT_TRUE(strcmp(buf, "

Test

") == 0); - CHECK_TRUE(output_buf_size == 14); + CHECK_TRUE(output_buf_size == 13); simple_archiver_helper_cleanup_c_string(&buf); __attribute__((cleanup(test_internal_cleanup_delete_temporary_file))) @@ -294,7 +294,7 @@ int main(void) { buf, "

Some text.


More text.

") == 0); - CHECK_TRUE(output_buf_size == 47); + CHECK_TRUE(output_buf_size == 46); simple_archiver_helper_cleanup_c_string(&buf); __attribute__((cleanup(test_internal_cleanup_delete_temporary_file)))