Closed
Bug 1117592
Opened 9 years ago
Closed 9 years ago
Use of single buffer as parameter and destination in snprintf in NetworkUtils.cpp
Categories
(Firefox OS Graveyard :: General, defect)
Firefox OS Graveyard
General
Tracking
(Not tracked)
RESOLVED
FIXED
2.2 S3 (9jan)
People
(Reporter: n.nethercote, Assigned: n.nethercote)
References
Details
Attachments
(1 file)
1.89 KB,
patch
|
fabrice
:
review+
|
Details | Diff | Splinter Review |
cppcheck says this: > dom/system/gonk/NetworkUtils.cpp:818: error: Undefined behavior: Variable 'command' is used as parameter and destination in s[n]printf(). And the man page for snprintf says the following > C99 and POSIX.1-2001 specify that the results are undefined if a call > to sprintf(), snprintf(), vsprintf(), or vsnprintf() would cause copy‐ > ing to take place between objects that overlap (e.g., if the target > string array and one of the supplied input arguments refer to the same > buffer). and later: > Some programs imprudently rely on code such as the following > > sprintf(buf, "%s some further text", buf); > > to append text to buf. However, the standards explicitly note that the > results are undefined if source and destination buffers overlap when > calling sprintf(), snprintf(), vsprintf(), and vsnprintf().
Assignee | ||
Comment 1•9 years ago
|
||
Attachment #8543702 -
Flags: review?(fabrice)
Updated•9 years ago
|
Attachment #8543702 -
Flags: review?(fabrice) → review+
Assignee | ||
Comment 2•9 years ago
|
||
https://hg.mozilla.org/integration/mozilla-inbound/rev/91c3845c87cf
Comment 3•9 years ago
|
||
https://hg.mozilla.org/mozilla-central/rev/91c3845c87cf
Status: NEW → RESOLVED
Closed: 9 years ago
Flags: in-testsuite-
Resolution: --- → FIXED
Target Milestone: --- → 2.2 S3 (9jan)
You need to log in
before you can comment on or make changes to this bug.
Description
•