Bug 60000 - Potentially dangerous code in camlibs/sonydscf55/camera.c
Summary: Potentially dangerous code in camlibs/sonydscf55/camera.c
Keywords:
Status: CLOSED NOTABUG
Alias: None
Product: Red Hat Raw Hide
Classification: Retired
Component: gphoto2
Version: 1.0
Hardware: i386
OS: Linux
medium
medium
Target Milestone: ---
Assignee: Tim Waugh
QA Contact:
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2002-02-18 19:58 UTC by Bernhard Rosenkraenzer
Modified: 2008-05-01 15:38 UTC (History)
0 users

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 2002-02-18 19:58:17 UTC
Embargoed:


Attachments (Terms of Use)

Description Bernhard Rosenkraenzer 2002-02-18 19:58:12 UTC
Found this code while debugging kamera: 
 
for (i = 0; i < sizeof(models) / sizeof(models[i]); i++) { 
[...] 
} 
 
Since AFAIK the compiler is free to add arbitrary padding in structures and arrays, the 
behavior of this code is pretty much undefined.

Comment 1 Tim Waugh 2002-02-19 10:16:50 UTC
Not so, from my interpretation of C99.  See example 2 (paragraph 6) of 6.5.3.4
"The sizeof operator".


Note You need to log in before you can comment on or make changes to this bug.