Coverity SECURE_CODING - CID 10020

Bug #957587 reported by Product Strategy Coverity Bug Uploader
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Compiz
Fix Released
Medium
MC Return
Compiz Core
Won't Fix
Medium
Unassigned
0.9.5
Won't Fix
Undecided
Unassigned
compiz (Ubuntu)
Fix Released
Undecided
Unassigned

Bug Description

This bug is exported from the Coverity Integration Manager on Canonical's servers. For information on how this is done please see this website: https://wiki.ubuntu.com/CanonicalProductStrategy/Coverity
CID: 10020
Checker: SECURE_CODING
Category: No category available
CWE definition: http://cwe.mitre.org/data/definitions/676.html
File: /tmp/buildd/compiz-0.9.7.0~bzr3025/libdecoration/decoration.c
Function: decor_handle_selection_clear()
Code snippet:
3168 {
3169 Atom dm_sn_atom;
3170 char buf[128];
3171
CID 10020 - SECURE_CODING
[VERY RISKY]. Using "sprintf" can cause a buffer overflow when done incorrectly. Because sprintf() assumes an arbitrarily long string, callers must be careful not to overflow the actual space of the destination. Use snprintf() instead, or correct precision specifiers.
3172 sprintf (buf, "_COMPIZ_DM_S%d", screen);
3173 dm_sn_atom = XInternAtom (xdisplay, buf, 0);
3174
3175 if (xevent->xselectionclear.selection == dm_sn_atom)
3176 return DECOR_SELECTION_GIVE_UP;
3177

Related branches

Revision history for this message
Product Strategy Coverity Bug Uploader (coverity-uploader) wrote : compiz-core-0.9.5: /tmp/buildd/compiz-0.9.7.0~bzr3025/libdecoration/decoration.c

Source file with Coverity annotations.

Changed in compiz-core:
importance: Undecided → Medium
Changed in compiz:
importance: Undecided → Medium
Revision history for this message
Test-tools (roland-verifysoft) wrote :

This is a false positive.
The buffer has 128 and the format string is "_COMPIZ_DM_S%d", 12 characters plus at max thear len of MAX_INT ->10 + one char for terminating 0 => 23 characters overall..

Revision history for this message
MC Return (mc-return) wrote :

roland-verifysoft, you are right, but lets get it off the table...

Changed in compiz:
status: New → In Progress
assignee: nobody → MC Return (mc-return)
Changed in compiz:
status: In Progress → Fix Committed
Revision history for this message
Launchpad Janitor (janitor) wrote :

This bug was fixed in the package compiz - 1:0.9.9~daily13.02.04-0ubuntu1

---------------
compiz (1:0.9.9~daily13.02.04-0ubuntu1) raring; urgency=low

  [ Marco Trevisan (Treviño) ]
  * Spread - Window glow is incorrectly painted in the screen when
    switching spreaded application (LP: #1109805)

  [ MC Return ]
  * Coverity MISSING_BREAK - CID 12463 (LP: #1101561)
  * Thumbnail plugin: Window title text is rendered into transparency
    and glow/background are too large (LP: #1099100)
  * Showmouse plugin code: Needs cleanup (LP: #1105969)
  * Coverity SECURE_CODING - CID 10019 (LP: #957582)
  * Coverity SECURE_CODING - CID 12511 (LP: #1101605)
  * Coverity SECURE_CODING - CID 12512 (LP: #1101571)
  * Keyboard shortcut overlay says Ctrl+Super+Down "minimises" the
    current window, but it doesn't (LP: #966099)
  * Coverity SECURE_CODING - CID 10020 (LP: #957587)
  * Coverity SECURE_CODING - CID 12529 (LP: #1101641)
  * Coverity MISSING_BREAK - CID 12464 (LP: #1101549)
  * Coverity SECURE_CODING - CID 12519 (LP: #1101565)
  * Coverity SECURE_CODING - CID 12516 (LP: #1101499)
  * [GLES] Showmouse plugin needs port to OpenGL|ES (LP: #1106270)

  [ Automatic PS uploader ]
  * Automatic snapshot from revision 3594
 -- Automatic PS uploader <email address hidden> Mon, 04 Feb 2013 04:01:58 +0000

Changed in compiz (Ubuntu):
status: New → Fix Released
Stephen M. Webb (bregma)
Changed in compiz:
status: Fix Committed → Fix Released
Changed in compiz-core:
status: New → Won't Fix
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.