fixed memory underflow bug in mvwasyncgetnstr

Sat, 12 Apr 2014 13:42:57 +0200

author
Mike Becker <universe@uap-core.de>
date
Sat, 12 Apr 2014 13:42:57 +0200
changeset 38
75ee459ba941
parent 37
bcf624518909
child 39
4d3d398ba689

fixed memory underflow bug in mvwasyncgetnstr

src/input.c file | annotate | diff | comparison | revisions
--- a/src/input.c	Thu Apr 10 12:10:09 2014 +0200
+++ b/src/input.c	Sat Apr 12 13:42:57 2014 +0200
@@ -58,7 +58,9 @@
             return 1;
         case KEY_BACKSPACE:
         case KEY_LEFT:
-            str[--(*pos)] = '\0';
+            if ((*pos) > 0) {
+                str[--(*pos)] = '\0';
+            }
             break;
         default:
             if (isprint(c) && *pos < len-1) {

mercurial