diff --git a/src/gmni.c b/src/gmni.c
index ff6c619f7c6cde57faa7398d4201d2cf867bf05a..f50733b738cc16afc699b6e64285c4cdbc024a22 100644
--- a/src/gmni.c
+++ b/src/gmni.c
@@ -189,7 +189,7 @@ hints.ai_family = AF_INET6;
break;
case 'd':
input_mode = INPUT_READ;
- input_source = fmemopen(optarg, strlen(optarg), "r");
+ input_source = fmemopen(optarg, strlen(optarg) + 1, "r");
break;
case 'D':
input_mode = INPUT_READ;