Bug 60000

Summary: Potentially dangerous code in camlibs/sonydscf55/camera.c
Product: [Retired] Red Hat Raw Hide Reporter: Bernhard Rosenkraenzer <bero>
Component: gphoto2Assignee: Tim Waugh <twaugh>
Status: CLOSED NOTABUG QA Contact:
Severity: medium Docs Contact:
Priority: medium    
Version: 1.0   
Target Milestone: ---   
Target Release: ---   
Hardware: i386   
OS: Linux   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2002-02-18 19:58:17 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

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".