aboutsummaryrefslogtreecommitdiff
path: root/src/Routes/Images.c
diff options
context:
space:
mode:
authorfrosty <frostinator33@airmail.cc>2026-10-27 20:31:28 -0400
committerfrosty <frostinator33@airmail.cc>2026-10-27 20:33:50 -0400
commit250898c638f07ace6bc7167faede93113c8fd0db (patch)
tree310addbedcaaf76da98df22434a4f4711c8ba963 /src/Routes/Images.c
parentbd3da2232540ea4c78e7ac35e2c90c38c8a3c410 (diff)
refactor: replace potentially unsafe string functions with snprintf
Diffstat (limited to 'src/Routes/Images.c')
-rw-r--r--src/Routes/Images.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/src/Routes/Images.c b/src/Routes/Images.c
index 1ab875e..3840587 100644
--- a/src/Routes/Images.c
+++ b/src/Routes/Images.c
@@ -27,12 +27,12 @@ static char *build_images_href(const char *query, int page) {
if (!href)
return NULL;
- snprintf(href, needed, "/images?q=%s", safe_query);
if (page > 1) {
char page_buf[16];
snprintf(page_buf, sizeof(page_buf), "%d", page);
- strcat(href, "&p=");
- strcat(href, page_buf);
+ snprintf(href, needed, "/images?q=%s&p=%s", safe_query, page_buf);
+ } else {
+ snprintf(href, needed, "/images?q=%s", safe_query);
}
return href;
}