Fix inconsistent http_template output size
All checks were successful
Run Unit Tests / build-and-run-unit-tests (push) Successful in 2s

This commit is contained in:
Stephen Seo 2024-09-05 16:18:28 +09:00
parent 8a9637d941
commit dd5934351e
2 changed files with 3 additions and 3 deletions

View file

@ -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.

View file

@ -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, "<h1>Test</h1>") == 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,
"<h1> Some text. </h1><br><h2> More text. </h2>")
== 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)))