Closed
Bug 690432
Opened 13 years ago
Closed 13 years ago
Logging.h passes a string directly to printf
Categories
(Core :: Graphics, defect)
Core
Graphics
Tracking
()
RESOLVED
FIXED
mozilla10
People
(Reporter: dholbert, Assigned: dholbert)
Details
Attachments
(1 file)
232 bytes,
patch
|
bas.schouten
:
review+
|
Details | Diff | Splinter Review |
Just noticed the attached patch in Ubuntu's patches for Firefox (from "apt-get source firefox").
The change is the following, in some GFX logging code:
> - printf(aString.c_str());
> + printf("%s", aString.c_str());
(If aString.c_str() were to contain printf-format-codes, I believe the current code would substitute in what it thinks are the corresponding arguments (random stack-memory), whereas the patched version wouldn't give the formatting codes any special handling & instead would just print them out verbatim.)
Since this is only used for internal logging, this probably isn't particularly worrisome; still, I think it's worth fixing, for correctness' sake. Bas, any objections?
(not sure who to credit the patch to, but it may be trivial enough that it doesn't really matter)
Attachment #563468 -
Flags: review?(bas.schouten)
Assignee | ||
Comment 1•13 years ago
|
||
The patch was added to Ubuntu's source tree in this commit, btw: http://bazaar.launchpad.net/~mozillateam/firefox/firefox-beta.head/revision/909 > * Fix "format not a string literal and no format arguments" error > - add debian/patches/printf-fix.patch
Assignee | ||
Comment 2•13 years ago
|
||
(CC'ing Chris Coulson of Ubuntu, who made that commit. Chris, assuming this gets review+, would you be the appropriate person to credit as patch-author?)
Assignee | ||
Updated•13 years ago
|
OS: Linux → All
Hardware: x86_64 → All
Comment 3•13 years ago
|
||
Comment on attachment 563468 [details] [diff] [review] fix: use printf format string Review of attachment 563468 [details] [diff] [review]: ----------------------------------------------------------------- Nice catch! Sounds like the right thing to do to me!
Attachment #563468 -
Flags: review?(bas.schouten) → review+
Comment 4•13 years ago
|
||
(In reply to Daniel Holbert [:dholbert] from comment #2) > (CC'ing Chris Coulson of Ubuntu, who made that commit. Chris, assuming this > gets review+, would you be the appropriate person to credit as patch-author?) Hi, Yes, that's fine. I'm not sure why I didn't get around to reporting this myself, sorry about that :/ Note that we build with -Werror=format-security on Ubuntu as part of the build hardening, so the GCC warning that this bug triggers ends up as an error
Assignee | ||
Comment 5•13 years ago
|
||
No worries on forgetting to file; thanks for the fix. :) Landed on mozilla-inbound: https://hg.mozilla.org/integration/mozilla-inbound/rev/719cb2ed1bf6
Whiteboard: [inbound]
Assignee | ||
Updated•13 years ago
|
Target Milestone: --- → mozilla10
Comment 6•13 years ago
|
||
https://hg.mozilla.org/mozilla-central/rev/719cb2ed1bf6
Assignee: nobody → dholbert
Status: NEW → RESOLVED
Closed: 13 years ago
Resolution: --- → FIXED
Whiteboard: [inbound]
You need to log in
before you can comment on or make changes to this bug.
Description
•