aboutsummaryrefslogtreecommitdiffstats
path: root/ui-shared.c
diff options
context:
space:
mode:
Diffstat (limited to 'ui-shared.c')
-rw-r--r--ui-shared.c12
1 files changed, 8 insertions, 4 deletions
diff --git a/ui-shared.c b/ui-shared.c
index 739505a..b53c56d 100644
--- a/ui-shared.c
+++ b/ui-shared.c
@@ -1159,7 +1159,7 @@ void cgit_print_snapshot_links(const struct cgit_repo *repo, const char *ref,
1159 1159
1160void cgit_set_title_from_path(const char *path) 1160void cgit_set_title_from_path(const char *path)
1161{ 1161{
1162 size_t path_len, path_index, path_last_end; 1162 size_t path_len, path_index, path_last_end, line_len;
1163 char *new_title; 1163 char *new_title;
1164 1164
1165 if (!path) 1165 if (!path)
@@ -1176,14 +1176,18 @@ void cgit_set_title_from_path(const char *path)
1176 continue; 1176 continue;
1177 } 1177 }
1178 strncat(new_title, &path[path_index + 1], path_last_end - path_index - 1); 1178 strncat(new_title, &path[path_index + 1], path_last_end - path_index - 1);
1179 strcat(new_title, "\\"); 1179 line_len = strlen(new_title);
1180 new_title[line_len++] = '\\';
1181 new_title[line_len] = '\0';
1180 path_last_end = path_index; 1182 path_last_end = path_index;
1181 } 1183 }
1182 } 1184 }
1183 if (path_last_end) 1185 if (path_last_end)
1184 strncat(new_title, path, path_last_end); 1186 strncat(new_title, path, path_last_end);
1185 1187
1186 strcat(new_title, " - "); 1188 line_len = strlen(new_title);
1187 strcat(new_title, ctx.page.title); 1189 memcpy(&new_title[line_len], " - ", 3);
1190 new_title[line_len + 3] = '\0';
1191 strncat(new_title, ctx.page.title, sizeof(new_title) - strlen(new_title) - 1);
1188 ctx.page.title = new_title; 1192 ctx.page.title = new_title;
1189} 1193}