- if ((cryptpap || strcmp(passwd, secret) != 0)
- && strcmp(crypt(passwd, secret), secret) != 0)
- ret = UPAP_AUTHNAK;
+ if (cryptpap || strcmp(passwd, secret) != 0) {
+ char *cbuf = crypt(passwd, secret);
+ if (!cbuf || strcmp(cbuf, secret) != 0)
+ ret = UPAP_AUTHNAK;
+ }