diff --git a/ncurses/tinfo/captoinfo.c b/ncurses/tinfo/captoinfo.c | |
index a0da44d..83c5216 100644 | |
--- a/ncurses/tinfo/captoinfo.c | |
+++ b/ncurses/tinfo/captoinfo.c | |
@@ -207,8 +207,13 @@ cvtchar(register const char *sp) | |
} | |
break; | |
case '^': | |
- c = (unsigned char) (*++sp & 0x1f); | |
len = 2; | |
+ c = (unsigned char) (*++sp); | |
+ if (c == '\0') { | |
+ len = 1; | |
+ } else { | |
+ c &= 0x1f; | |
+ } | |
break; | |
default: | |
c = (unsigned char) (*sp); |