diff --git a/src/winio.c b/src/winio.c
index 32fdb34fc5ed7db02eb47bae04fba9ebd9b50e97..abde66d93a29974238575603ea1d74f8977d70d1 100644
--- a/src/winio.c
+++ b/src/winio.c
@@ -2455,7 +2455,7 @@ int nanogetstr(bool allow_tabs, const char *buf, const char *curranswer,
 #endif
 
     answer = mallocstrcpy(answer, curranswer);
-    curranswer = strlen(answer);
+    curranswer_len = strlen(answer);
 
     /* Only put statusbar_x at the end of the string if it's
      * uninitialized, if it would be past the end of curranswer, or if