Closed Bug 110665 Opened 24 years ago Closed 24 years ago

Leak imap password if it's blank

Categories

(MailNews Core :: Networking: IMAP, defect)

defect
Not set
normal

Tracking

(Not tracked)

VERIFIED FIXED

People

(Reporter: Bienvenu, Assigned: Bienvenu)

Details

(Keywords: memory-leak)

Attachments

(2 files)

If we don't have an imap password yet, we leak the one byte string we get back from ToNewCString (probably a result of jag's string changes). Fix (to use nsXPIDLCString so we'll be less vulnerable to people messing up our code with string changes) coming up.
Attached patch proposed fixSplinter Review
why did you remove all the null-checks? I know because I have fixed crashes which use similar constructs, please check for null.
Keywords: mlk
Navin, an automatic nsXPIDLCString can't be null.
I changed this to use IsEmpty instead of looking at the length. I tried it with an empty password and didn't crash. Navin, could you elaborate more on why you feel null checks are needed?
ok, r=naving
They keep changing strings. A couple of months back I was made to check for null for pop3 GetPassword.
Yeah, it's a pain the way they keep changing the string classes. Are you referring to this code? : nsXPIDLString passwordTitle; mStringService->GetStringByID(POP3_ENTER_PASSWORD_PROMPT_TITLE, getter_Copies(passwordTitle)); if (passwordPromptString) { if (passwordTitle) rv = server->GetPasswordWithUI(passwordPromptString, passwordTitle.get(), aMsgWindow, okayValue, aPassword); nsTextFormatter::smprintf_free(passwordPromptString); } this looks wrong to me - I think you should be checking !passwordTitle.IsEmpty(). Are they equivalent, Seth?
yes, i was referring to this code. if (passwordTitle) checks if PRUnichar* is null, which i believe is the same thing as IsEmpty --> Length() == 0
fix checked in.
Status: NEW → RESOLVED
Closed: 24 years ago
Resolution: --- → FIXED
Stephen, can you help for verifying this bug? Thanks. :-)
QA Contact: huang → stephend
This is VERIFIED FIXED, but check out bug 99140 for some window-leaking nastiness!
Status: RESOLVED → VERIFIED
Product: MailNews → Core
Product: Core → MailNews Core
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: