aboutsummaryrefslogtreecommitdiff
path: root/src/Infobox/Wikipedia.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/Infobox/Wikipedia.c')
-rw-r--r--src/Infobox/Wikipedia.c16
1 files changed, 8 insertions, 8 deletions
diff --git a/src/Infobox/Wikipedia.c b/src/Infobox/Wikipedia.c
index 6108bce..7f76e8b 100644
--- a/src/Infobox/Wikipedia.c
+++ b/src/Infobox/Wikipedia.c
@@ -33,7 +33,7 @@ static void shorten_summary(char **extract_ptr, int max_chars) {
if (new_text) {
strncpy(new_text, text, end_pos);
new_text[end_pos] = '\0';
- strcat(new_text, "...");
+ strncat(new_text, "...", 3);
free(*extract_ptr);
*extract_ptr = new_text;
}
@@ -65,8 +65,8 @@ static void extract_wiki_info(xmlNode *node, InfoBox *info) {
info->url =
malloc(strlen(base_article_url) + strlen(formatted_title) + 1);
if (info->url) {
- strcpy(info->url, base_article_url);
- strcat(info->url, formatted_title);
+ snprintf(info->url, strlen(base_article_url) + strlen(formatted_title) + 1,
+ "%s%s", base_article_url, formatted_title);
}
free(formatted_title);
xmlFree(title);
@@ -177,9 +177,9 @@ static char *get_first_search_result(const char *search_term) {
return NULL;
}
- strcpy(search_url, search_base);
- strcat(search_url, escaped_term);
- strcat(search_url, search_suffix);
+ snprintf(search_url, strlen(search_base) + strlen(escaped_term) +
+ strlen(search_suffix) + 1, "%s%s%s", search_base,
+ escaped_term, search_suffix);
curl_free(escaped_term);
@@ -226,8 +226,8 @@ char *construct_wiki_url(const char *search_term) {
char *full_url = malloc(strlen(base) + strlen(escaped_title) + 1);
if (full_url) {
- strcpy(full_url, base);
- strcat(full_url, escaped_title);
+ snprintf(full_url, strlen(base) + strlen(escaped_title) + 1, "%s%s", base,
+ escaped_title);
}
curl_free(escaped_title);