Fix coverity #920. Possible NULL deref.
authorJeremy Allison <jra@samba.org>
Fri, 19 Jun 2009 22:29:35 +0000 (15:29 -0700)
committerJeremy Allison <jra@samba.org>
Fri, 19 Jun 2009 22:29:35 +0000 (15:29 -0700)
Jeremy.

source3/utils/pdbedit.c

index 23c4e71e0d228d21b6e8161fa7511fd45f68df3b..a4642994388d05dce50091928701f1d45ba9b205 100644 (file)
@@ -708,6 +708,10 @@ static int new_user(const char *username, const char *fullname,
 
        pwd1 = get_pass( "new password:", stdin_get);
        pwd2 = get_pass( "retype new password:", stdin_get);
+       if (!pwd1 || !pwd2) {
+               fprintf(stderr, "Failed to read passwords.\n");
+               return -1;
+       }
        ret = strcmp(pwd1, pwd2);
        if (ret != 0) {
                fprintf (stderr, "Passwords do not match!\n");