diff --git a/src/gmnlm.c b/src/gmnlm.c
index da43dbe2ce10637c2f267e2cc75c0a7a6f3cea92..2eb906e1312a346fe2ad479fa5f49b1d155927b8 100644
--- a/src/gmnlm.c
+++ b/src/gmnlm.c
@@ -609,7 +609,7 @@ case 'd':
if (in[1] != '\0' && !isspace(in[1])) break;
struct gemini_response resp;
char url[1024] = {0};
- strncpy(&url[0], browser->plain_url, sizeof(url));
+ strncpy(&url[0], browser->plain_url, sizeof(url)-1);
// XXX: may affect history, do we care?
enum gemini_result res = do_requests(browser, &resp);
if (res != GEMINI_OK) {
@@ -624,7 +624,7 @@ gemini_response_finish(&resp);
result = PROMPT_AGAIN;
goto exit;
case '|':
- strncpy(&url[0], browser->plain_url, sizeof(url));
+ strncpy(&url[0], browser->plain_url, sizeof(url)-1);
res = do_requests(browser, &resp);
if (res != GEMINI_OK) {
fprintf(stderr, "Error: %s\n",