Closed Bug 1211780 Opened 9 years ago Closed 9 years ago

cannot save password if two password fields with same values

Categories

(Toolkit :: Password Manager, defect)

41 Branch
defect
Not set
normal

Tracking

()

RESOLVED FIXED
mozilla44
Tracking Status
firefox42 --- fixed
firefox43 --- fixed
firefox44 --- fixed

People

(Reporter: tldmartin, Assigned: glob)

References

Details

Attachments

(1 file, 1 obsolete file)

I think there's a null pointer bug in LoginManagerContent.jsm. In the code below, oldPasswordField being set to null, and then we try to use the id and name attributes from it. 


    } else { // pwFields.length == 2
      if (pw1 == pw2) {
        // Treat as if 1 pw field
        newPasswordField = pwFields[0].element;
        oldPasswordField = null;
      } else {
        // Just assume that the 2nd password is the new password
        oldPasswordField = pwFields[0].element;
        newPasswordField = pwFields[1].element;
      }
    }

    log("Password field (new) id/name is: ", newPasswordField.id, " / ", newPasswordField.name);
    log("Password field (old) id/name is: ", oldPasswordField.id, " / ", oldPasswordField.name);
    return [usernameField, newPasswordField, oldPasswordField];
  },


This occurs when submitting a form with two password fields containing the same value (eg, registration screen where you choose then confirm your password). The consequence is that the password never gets saved.
This is the line where the error occurs:

log("Password field (old) id/name is: ", oldPasswordField.id, " / ", oldPasswordField.name);
Component: General → Password Manager
Product: Firefox → Toolkit
Attached patch 1211780.patch (obsolete) — Splinter Review
Assignee: nobody → glob
Status: UNCONFIRMED → ASSIGNED
Ever confirmed: true
Attachment #8670123 - Flags: review?(dolske)
Comment on attachment 8670123 [details] [diff] [review]
1211780.patch

Review of attachment 8670123 [details] [diff] [review]:
-----------------------------------------------------------------

Uhh. Wow, this broke in Firefox 40 but hasn't been noticed until now?! I'm actually a bit shocked we don't have test coverage for this?

::: toolkit/components/passwordmgr/LoginManagerContent.jsm
@@ +713,5 @@
>        }
>      }
>  
>      log("Password field (new) id/name is: ", newPasswordField.id, " / ", newPasswordField.name);
> +    if (oldPasswordField != null)

Just "if (oldPasswordField)", please.
Attachment #8670123 - Flags: review?(dolske) → review+
Blocks: 1146065
Attached patch 1211780.patchSplinter Review
Attachment #8670123 - Attachment is obsolete: true
Attachment #8670613 - Flags: review?(dolske)
Attachment #8670613 - Flags: review?(dolske) → review+
Keywords: checkin-needed
https://hg.mozilla.org/mozilla-central/rev/8752bb087900
Status: ASSIGNED → RESOLVED
Closed: 9 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla44
Comment on attachment 8670613 [details] [diff] [review]
1211780.patch

Approval Request Comment
[Feature/regressing bug #]: bug 1211780
[User impact if declined]: Can't save passwords when signing up for accounts on some sites
[Describe test coverage new/current, TreeHerder]: Apparently none specifically for this, since it was missed!
[Risks and why]: Low risk. Otherwise well-exercised common code.
[String/UUID change made/needed]: n/a
Attachment #8670613 - Flags: approval-mozilla-beta?
Attachment #8670613 - Flags: approval-mozilla-aurora?
Comment on attachment 8670613 [details] [diff] [review]
1211780.patch

Fix an issue in the password management, taking it. Should be in 42 beta 5
Attachment #8670613 - Flags: approval-mozilla-beta?
Attachment #8670613 - Flags: approval-mozilla-beta+
Attachment #8670613 - Flags: approval-mozilla-aurora?
Attachment #8670613 - Flags: approval-mozilla-aurora+
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: