From cb1c3ce5ff5bd7bb3a01be229735a58487a26071 Mon Sep 17 00:00:00 2001
From: ChouTatsumi <choutatsumi@gmail.com>
Date: Mon, 29 Apr 2019 21:08:13 +1000
Subject: [PATCH] test 21:08

---
 server.c | 11 ++++-------
 1 file changed, 4 insertions(+), 7 deletions(-)

diff --git a/server.c b/server.c
index e638ec6..f357149 100644
--- a/server.c
+++ b/server.c
@@ -378,19 +378,16 @@ bool show_modified_page(int sockfd, const char* htmldir, char* added,
 bool show_start_page(int sockfd, char* username) {
     int username_length = strlen(username);
     char* added_prefix = "<p>";
-    int added_prefix_length = strlen(added_prefix);
     char* added_suffix = "</p>\n\n";
-    int added_suffix_length = sizeof(added_suffix);
     // the length needs to include the html tags for the username
     int added_length = username_length + 9;
 
     char added[added_length];
 
     // create added string
-    strncpy(added, added_prefix, added_prefix_length);
-    strncpy(added + added_prefix_length, username, username_length);
-    strncpy(added + added_prefix_length + username_length, added_suffix,
-            added_suffix_length);
+    strcat(added, added_prefix);
+    strcat(added, username);
+    strcat(added, added_suffix);
 
     return show_modified_page(sockfd, START_PAGE, added, 212);
 }
@@ -407,7 +404,7 @@ bool show_accepted_page(int sockfd) {
     int added_suffix_length = sizeof(added_suffix);
 
     for (int i = 0; i < list_len; i++) {
-        
+
     }
 
     return show_modified_page(sockfd, ACCEPTED_PAGE, added, 212);
-- 
GitLab