Bug 1037715

Summary: opensc: minor overflow leading to big-endian compatibility issue
Product: Red Hat Enterprise Linux 7 Reporter: Florian Weimer <fweimer>
Component: openscAssignee: Nikos Mavrogiannopoulos <nmavrogi>
Status: CLOSED NEXTRELEASE QA Contact: Release Test Team <release-test-team>
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: 7.0CC: fweimer, pkotvan, pvrabec
Target Milestone: rcKeywords: Rebase
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: Rebase: Bug Fixes and Enhancements
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2015-08-26 14:38:14 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Bug Depends On:    
Bug Blocks: 1036175    

Description Florian Weimer 2013-12-03 16:15:31 UTC
Clang warns about this:

opensc-explorer.c:309:33: warning: format specifies type 'unsigned int *' but the argument has type 'u8 *' (aka 'unsigned char *') [-Wformat]
    if (sscanf(arg, "%02X%02X", &fid[0], &fid[1]) != 2) {
                     ~~~~       ^~~~~~~
                     %2s
opensc-explorer.c:309:42: warning: format specifies type 'unsigned int *' but the argument has type 'u8 *' (aka 'unsigned char *') [-Wformat]
    if (sscanf(arg, "%02X%02X", &fid[0], &fid[1]) != 2) {
                         ~~~~            ^~~~~~~
                         %2s

This writes useful values to fid[0] and fid[1] on little-endian architectures, and zero on big-endian architectures.

Comment 4 Nikos Mavrogiannopoulos 2014-06-05 09:47:48 UTC
This has been addressed in the following upstream commit:
https://github.com/OpenSC/OpenSC/commit/1a972920f0dd4959bd6ec3c4cddef2d98e6009a8