Closed Bug 1094169 Opened 10 years ago Closed 9 years ago

Possible misuse of |NS_ConvertUTF16toUTF8| in |NfcMessageHandler::Marshall|

Categories

(Firefox OS Graveyard :: NFC, defect)

x86_64
Windows 7
defect
Not set
normal

Tracking

(Not tracked)

RESOLVED WONTFIX

People

(Reporter: Dexter, Unassigned)

References

Details

(Whiteboard: [good first bug])

|NfcMessageHandler::Marshall| [1] locally stores and uses the memory returned by |NS_ConvertUTF16toUTF8::get()|:

const char* type = NS_ConvertUTF16toUTF8(aOptions.mType).get();

This should probably change since |NS_ConvertUTF16toUTF8| returns a stack object with a destructor that frees the memory that get() points to. It could be changed as follows:

nsCString value = NS_ConvertUTF16toUTF8(aOptions.mType);
const char* type = value.get();

[1] - http://dxr.mozilla.org/mozilla-central/source/dom/nfc/gonk/NfcMessageHandler.cpp#43
Assignee: nobody → allstars.chh
Blocks: b2g-nfc
Could this be a good candidate for a "good first bug" or a "mentored" bug?
Flags: needinfo?(allstars.chh)
Assignee: allstars.chh → nobody
Flags: needinfo?(allstars.chh)
Whiteboard: [good first bug]
fixed in Bug 1137107
Status: NEW → RESOLVED
Closed: 9 years ago
Resolution: --- → WONTFIX
You need to log in before you can comment on or make changes to this bug.