]> granicus.if.org Git - curl/commitdiff
getpass: fix password parsing from console
authorMaks Naumov <maksqwe1@ukr.net>
Mon, 27 Jan 2014 14:52:42 +0000 (16:52 +0200)
committerDaniel Stenberg <daniel@haxx.se>
Tue, 28 Jan 2014 12:28:00 +0000 (13:28 +0100)
Incorrect password if use backspace while entered the password.

Regression from f7bfdbabf2d5398f4c266eabb0992a04af661f22

The '?:' operator has lower priority than the '-' operator

src/tool_getpass.c

index 0ac7dcbe01eeda35d9e458de786aa0238a983b32..4c8dcb9f1f8d8435b70d5bee2e92fc2d2d39155a 100644 (file)
@@ -117,7 +117,7 @@ char *getpass_r(const char *prompt, char *buffer, size_t buflen)
       if(buffer[i] == '\b')
         /* remove this letter and if this is not the first key, remove the
            previous one as well */
-        i = i - (i >= 1) ? 2 : 1;
+        i = i - (i >= 1 ? 2 : 1);
   }
 #ifndef __SYMBIAN32__
   /* since echo is disabled, print a newline */