OBS User unknown
2009-08-07 13:41:50 +00:00
committed by Git OBS Bridge
parent ac2aa58f55
commit 60f4736641
9 changed files with 32 additions and 347 deletions

View File

@@ -1 +1 @@
pcsc-lite
libpcsclite1

View File

@@ -1,3 +0,0 @@
version https://git-lfs.github.com/spec/v1
oid sha256:2dd18024f5730587cbfac04da8fd57b8910ce79e4e98f5a311f72e797f0485dd
size 469752

3
pcsc-lite-1.5.5.tar.bz2 Normal file
View File

@@ -0,0 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:051de6f3c1deff9a9c6f72995f6b9d271a23fc8aea74737f1902cabf1a71ed26
size 465947

View File

@@ -1,8 +0,0 @@
--- NEWS
+++ NEWS
@@ -3,4 +3,4 @@
Checkout the new MuscleCard. Its an applet for Java Card which
will run on any 2.1 compliant card. It has client side API's
for nearly every major operating system and it's totally free.
-Go to: http://www.musclecard.com/musclecard.html
+Go to: http://www.musclecard.com/

View File

@@ -1,125 +0,0 @@
Author: rousseau
Date: Thu May 14 09:29:39 2009
New Revision: 4208
URL: http://svn.debian.org/wsvn/pcsclite/?sc=1&rev=4208
Log:
MSGFunctionDemarshall(): detect buffer overflows
Thanks to Sebastian Krahmer for the bug report
Modified:
trunk/PCSC/src/winscard_svc.c
Modified: trunk/PCSC/src/winscard_svc.c
URL: http://svn.debian.org/wsvn/pcsclite/trunk/PCSC/src/winscard_svc.c?rev=4208&op=diff
==============================================================================
--- trunk/PCSC/src/winscard_svc.c (original)
+++ trunk/PCSC/src/winscard_svc.c Thu May 14 09:29:39 2009
@@ -387,6 +387,14 @@
dwProtocol = stStr->pdwProtocol;
cbAtrLen = stStr->pcbAtrLen;
+ /* avoids buffer overflow */
+ if ((cchReaderLen > sizeof(stStr->mszReaderNames))
+ || (cbAtrLen > sizeof(stStr->pbAtr)))
+ {
+ stStr->rv = SCARD_E_INSUFFICIENT_BUFFER ;
+ break;
+ }
+
stStr->rv = SCardStatus(stStr->hCard, stStr->mszReaderNames,
&cchReaderLen, &dwState,
&dwProtocol, stStr->pbAtr, &cbAtrLen);
@@ -401,6 +409,14 @@
trStr = ((transmit_struct *) msgStruct->data);
rv = MSGCheckHandleAssociation(trStr->hCard, dwContextIndex);
if (rv != 0) return rv;
+
+ /* avoids buffer overflow */
+ if ((trStr->pcbRecvLength > sizeof(trStr->pbRecvBuffer))
+ || (trStr->cbSendLength > sizeof(trStr->pbSendBuffer)))
+ {
+ trStr->rv = SCARD_E_INSUFFICIENT_BUFFER ;
+ break;
+ }
ioSendPci.dwProtocol = trStr->pioSendPciProtocol;
ioSendPci.cbPciLength = trStr->pioSendPciLength;
@@ -426,6 +442,14 @@
rv = MSGCheckHandleAssociation(ctStr->hCard, dwContextIndex);
if (rv != 0) return rv;
+ /* avoids buffer overflow */
+ if ((ctStr->dwBytesReturned > sizeof(ctStr->cbRecvLength))
+ || (ctStr->cbSendLength > sizeof(ctStr->pbSendBuffer)))
+ {
+ ctStr->rv = SCARD_E_INSUFFICIENT_BUFFER;
+ break;
+ }
+
dwBytesReturned = ctStr->dwBytesReturned;
ctStr->rv = SCardControl(ctStr->hCard, ctStr->dwControlCode,
@@ -442,6 +466,13 @@
rv = MSGCheckHandleAssociation(gsStr->hCard, dwContextIndex);
if (rv != 0) return rv;
+ /* avoids buffer overflow */
+ if (gsStr->cbAttrLen > sizeof(gsStr->pbAttr))
+ {
+ gsStr->rv = SCARD_E_INSUFFICIENT_BUFFER ;
+ break;
+ }
+
cbAttrLen = gsStr->cbAttrLen;
gsStr->rv = SCardGetAttrib(gsStr->hCard, gsStr->dwAttrId,
@@ -455,6 +486,14 @@
gsStr = ((getset_struct *) msgStruct->data);
rv = MSGCheckHandleAssociation(gsStr->hCard, dwContextIndex);
if (rv != 0) return rv;
+
+ /* avoids buffer overflow */
+ if (gsStr->cbAttrLen <= sizeof(gsStr->pbAttr))
+ {
+ gsStr->rv = SCARD_E_INSUFFICIENT_BUFFER ;
+ break;
+ }
+
gsStr->rv = SCardSetAttrib(gsStr->hCard, gsStr->dwAttrId,
gsStr->pbAttr, gsStr->cbAttrLen);
break;
@@ -468,6 +507,15 @@
treStr = ((transmit_struct_extended *) msgStruct->data);
rv = MSGCheckHandleAssociation(treStr->hCard, dwContextIndex);
if (rv != 0) return rv;
+
+ /* avoids buffer overflow */
+ if ((treStr->size > sizeof(pbSendBuffer))
+ || (treStr->cbSendLength > sizeof(pbSendBuffer))
+ || (treStr->pcbRecvLength > sizeof(pbRecvBuffer)))
+ {
+ treStr->rv = SCARD_E_INSUFFICIENT_BUFFER;
+ break;
+ }
/* on more block to read? */
if (treStr->size > PCSCLITE_MAX_MESSAGE_SIZE)
@@ -549,6 +597,15 @@
cteStr = ((control_struct_extended *) msgStruct->data);
rv = MSGCheckHandleAssociation(cteStr->hCard, dwContextIndex);
if (rv != 0) return rv;
+
+ /* avoids buffer overflow */
+ if ((cteStr->size > sizeof(pbSendBuffer))
+ || (cteStr->cbSendLength > sizeof(pbSendBuffer))
+ || (cteStr->cbRecvLength > sizeof(pbRecvBuffer)))
+ {
+ cteStr->rv = SCARD_E_INSUFFICIENT_BUFFER;
+ break;
+ }
/* on more block to read? */
if (cteStr->size > PCSCLITE_MAX_MESSAGE_SIZE)

View File

@@ -1,45 +0,0 @@
Author: rousseau
Date: Tue May 19 14:43:56 2009
New Revision: 4213
URL: http://svn.debian.org/wsvn/pcsclite/?sc=1&rev=4213
Log:
main(): force access rights on /var/run/pcscd to be sure it can be used
by a libpcsclite client without privileges
Thanks to Sébastien Lorquet for the bug report
Modified:
trunk/PCSC/src/pcscdaemon.c
Modified: trunk/PCSC/src/pcscdaemon.c
URL: http://svn.debian.org/wsvn/pcsclite/trunk/PCSC/src/pcscdaemon.c?rev=4213&op=diff
==============================================================================
--- trunk/PCSC/src/pcscdaemon.c (original)
+++ trunk/PCSC/src/pcscdaemon.c Tue May 19 14:43:56 2009
@@ -396,14 +396,20 @@
rv = SYS_Stat(PCSCLITE_IPC_DIR, &fStatBuf);
if (rv < 0)
{
- rv = SYS_Mkdir(PCSCLITE_IPC_DIR,
- S_IROTH | S_IXOTH | S_IRGRP | S_IXGRP | S_IRWXU);
+ int mode = S_IROTH | S_IXOTH | S_IRGRP | S_IXGRP | S_IRWXU;
+
+ rv = SYS_Mkdir(PCSCLITE_IPC_DIR, mode);
if (rv != 0)
{
Log2(PCSC_LOG_CRITICAL,
"cannot create " PCSCLITE_IPC_DIR ": %s", strerror(errno));
return EXIT_FAILURE;
}
+
+ /* set mode so that the directory is world readable and
+ * executable even is umask is restrictive
+ * The directory containes files used by libpcsclite */
+ (void)SYS_Chmod(PCSCLITE_IPC_DIR, mode);
}
/*

View File

@@ -1,149 +0,0 @@
winscard_clnt.c:505: warning: dereferencing pointer 'veStr' does break strict-aliasing rules
winscard_clnt.c:504: warning: dereferencing pointer 'veStr' does break strict-aliasing rules
winscard_clnt.c:501: warning: dereferencing pointer 'veStr' does break strict-aliasing rules
winscard_clnt.c:501: warning: dereferencing pointer 'veStr' does break strict-aliasing rules
winscard_clnt.c:485: warning: dereferencing pointer 'veStr' does break strict-aliasing rules
winscard_clnt.c:484: warning: dereferencing pointer 'veStr' does break strict-aliasing rules
winscard_svc.c:209: warning: dereferencing pointer 'veStr' does break strict-aliasing rules
winscard_svc.c:208: warning: dereferencing pointer 'veStr' does break strict-aliasing rules
winscard_svc.c:204: warning: dereferencing pointer 'veStr' does break strict-aliasing rules
winscard_svc.c:198: warning: dereferencing pointer 'veStr' does break strict-aliasing rules
winscard_svc.c:198: warning: dereferencing pointer 'veStr' does break strict-aliasing rules
winscard_svc.c:196: warning: dereferencing pointer 'veStr' does break strict-aliasing rules
winscard_svc.c:196: warning: dereferencing pointer 'veStr' does break strict-aliasing rules
winscard_svc.c:194: warning: dereferencing pointer 'veStr' does break strict-aliasing rules
winscard_svc.c:191: warning: dereferencing pointer 'veStr' does break strict-aliasing rules
winscard_svc.c:187: warning: dereferencing pointer 'veStr' does break strict-aliasing rules
winscard_svc.c:187: warning: dereferencing pointer 'veStr' does break strict-aliasing rules
winscard_svc.c:185: warning: dereferencing pointer 'veStr' does break strict-aliasing rules
winscard_svc.c:184: warning: dereferencing pointer 'veStr' does break strict-aliasing rules
cc1: warning: dereferencing pointer 'veStr' does break strict-aliasing rules
testpcsc.c:313: warning: dereferencing type-punned pointer will break strict-aliasing rules
testpcsc.c:323: warning: dereferencing type-punned pointer will break strict-aliasing rules
================================================================================
--- src/testpcsc.c
+++ src/testpcsc.c
@@ -65,7 +65,11 @@
#else
unsigned char pbAtr[MAX_ATR_SIZE];
#endif
- unsigned char buf[100];
+ union {
+ unsigned char _char[100];
+ DWORD _DWORD[1];
+ uint32_t _uint32_t[1];
+ } buf;
DWORD dwBufLen;
unsigned char *pbAttr = NULL;
DWORD pcbAttrLen;
@@ -306,31 +310,31 @@
printf("Testing SCardGetAttrib\t\t: ");
dwBufLen = sizeof(buf);
- rv = SCardGetAttrib(hCard, SCARD_ATTR_VENDOR_IFD_VERSION, buf, &dwBufLen);
+ rv = SCardGetAttrib(hCard, SCARD_ATTR_VENDOR_IFD_VERSION, buf._char, &dwBufLen);
test_rv(rv, hContext, DONT_PANIC);
if (rv == SCARD_S_SUCCESS)
printf("Vendor IFD version\t\t: " GREEN "0x%08lX\n" NORMAL,
- ((DWORD *)buf)[0]);
+ buf._DWORD[0]);
printf("Testing SCardGetAttrib\t\t: ");
dwBufLen = sizeof(buf);
- rv = SCardGetAttrib(hCard, SCARD_ATTR_MAXINPUT, buf, &dwBufLen);
+ rv = SCardGetAttrib(hCard, SCARD_ATTR_MAXINPUT, buf._char, &dwBufLen);
test_rv(rv, hContext, DONT_PANIC);
if (rv == SCARD_S_SUCCESS)
{
if (dwBufLen == sizeof(uint32_t))
printf("Max message length\t\t: " GREEN "%d\n" NORMAL,
- *(uint32_t *)buf);
+ buf._uint32_t[0]);
else
printf(RED "Wrong size" NORMAL);
}
printf("Testing SCardGetAttrib\t\t: ");
dwBufLen = sizeof(buf);
- rv = SCardGetAttrib(hCard, SCARD_ATTR_VENDOR_NAME, buf, &dwBufLen);
+ rv = SCardGetAttrib(hCard, SCARD_ATTR_VENDOR_NAME, buf._char, &dwBufLen);
test_rv(rv, hContext, DONT_PANIC);
if (rv == SCARD_S_SUCCESS)
- printf("Vendor name\t\t\t: " GREEN "%s\n" NORMAL, buf);
+ printf("Vendor name\t\t\t: " GREEN "%s\n" NORMAL, buf._char);
printf("Testing SCardSetAttrib\t\t: ");
rv = SCardSetAttrib(hCard, SCARD_ATTR_ATR_STRING, (LPCBYTE)"", 1);
--- src/winscard_clnt.c
+++ src/winscard_clnt.c
@@ -480,7 +480,7 @@
msgStruct.command = 0;
msgStruct.date = time(NULL);
- veStr = (version_struct *) msgStruct.data;
+ veStr = &msgStruct.veStr;
veStr->major = PROTOCOL_VERSION_MAJOR;
veStr->minor = PROTOCOL_VERSION_MINOR;
--- src/winscard_msg.h
+++ src/winscard_msg.h
@@ -31,6 +31,17 @@
#endif
/**
+ * @brief Information transmitted in \ref CMD_VERSION Messages.
+ */
+ struct version_struct
+ {
+ int32_t major; /**< IPC major \ref PROTOCOL_VERSION_MAJOR */
+ int32_t minor; /**< IPC minor \ref PROTOCOL_VERSION_MINOR */
+ uint32_t rv;
+ };
+ typedef struct version_struct version_struct;
+
+ /**
* @brief General structure for client/serve message data exchange.
*
* It is used in the calls of \c SHMMessageSend and \c SHMMessageReceive.
@@ -49,7 +60,11 @@
uint32_t command; /** one of the \c pcsc_msg_commands */
uint64_t date;
unsigned char key[PCSCLITE_MSG_KEY_LEN]; /* 16 bytes */
- unsigned char data[PCSCLITE_MAX_MESSAGE_SIZE];
+ union
+ {
+ unsigned char data[PCSCLITE_MAX_MESSAGE_SIZE];
+ struct version_struct veStr;
+ };
}
sharedSegmentMsg, *psharedSegmentMsg;
@@ -93,17 +108,6 @@
SCARD_CONTROL_EXTENDED = 0x12 /**< used by SCardControl() */
};
- /**
- * @brief Information transmitted in \ref CMD_VERSION Messages.
- */
- struct version_struct
- {
- int32_t major; /**< IPC major \ref PROTOCOL_VERSION_MAJOR */
- int32_t minor; /**< IPC minor \ref PROTOCOL_VERSION_MINOR */
- uint32_t rv;
- };
- typedef struct version_struct version_struct;
-
struct client_struct
{
uint32_t hContext;
--- src/winscard_svc.c
+++ src/winscard_svc.c
@@ -178,7 +178,7 @@
if (msgStruct.mtype == CMD_VERSION)
{
version_struct *veStr;
- veStr = (version_struct *) msgStruct.data;
+ veStr = &msgStruct.veStr;
/* get the client protocol version */
psContext[dwContextIndex].protocol_major = veStr->major;

View File

@@ -1,3 +1,27 @@
-------------------------------------------------------------------
Thu Aug 6 18:38:30 CEST 2009 - sbrabec@suse.cz
- Updated to version 1.5.3:
* add the reader interface name if provided by the device
* SCardTransmit(): return SCARD_E_UNSUPPORTED_FEATURE if
SCARD_PROTOCOL_RAW is requested by unsupported
* SCardConnect() and SCardReconnect(): set dwActiveProtocol to
SCARD_PROTOCOL_UNDEFINED if SCARD_SHARE_DIRECT is used (conform
to MSDN).
* SCardControl(): correctly check for buffer overflow.
* SCardGetStatusChange() works again.
* detect buffer overflows if pcscd if used by a rogue client
* force access rights on /var/run/pcscd to be sure it can be used
by a libpcsclite client without privileges
* create the PCSCLITE_EVENTS_DIR directory with the sticky bit so
only root or the owner of the event files can remove them
* if RFAddReader() fails with the libhal scheme then we try with
the (old) libusb scheme.
* give a higher priority to a specific driver over the CCID Class
driver.
* some other minor improvements and bug corrections
- Fixed baselibs.conf.
-------------------------------------------------------------------
Thu Jun 4 14:28:02 CEST 2009 - sbrabec@suse.cz

View File

@@ -1,5 +1,5 @@
#
# spec file for package pcsc-lite (Version 1.5.3)
# spec file for package pcsc-lite (Version 1.5.5)
#
# Copyright (c) 2009 SUSE LINUX Products GmbH, Nuernberg, Germany.
#
@@ -22,8 +22,8 @@ Name: pcsc-lite
# FIXME: Maybe we should use /usr/lib/pcsc/drivers as others do:
%define ifddir %{_libdir}/readers
BuildRequires: hal-devel pkg-config readline-devel
Version: 1.5.3
Release: 2
Version: 1.5.5
Release: 1
PreReq: %{insserv_prereq} %{fillup_prereq}
Group: Productivity/Security
License: BSD 3-clause (or similar)
@@ -33,14 +33,7 @@ Source: %{name}-%{version}.tar.bz2
Source1: %{name}.sysconfig
Source2: README.SUSE
Source3: pre_checkin.sh
Patch: pcsc-lite-musclecard.patch
Patch1: pcsc-lite-init.patch
# PATCH-FIX-UPSTREAM pcsc-lite-overflow.patch bnc499734 sbrabec@suse.cz -- Fix possible buffer overflows.
Patch2: pcsc-lite-overflow.patch
# PATCH-FIX-UPSTREAM pcsc-lite-strict-aliasing.patch sbrabec@suse.cz -- Strict aliasing fix.
Patch3: pcsc-lite-strict-aliasing.patch
# PATCH-FIX-UPSTREAM pcsc-lite-strict-aliasing.patch bnc466211 sbrabec@suse.cz -- Fix permissions of /var/run/pcscd.
Patch4: pcsc-lite-permissions.patch
Requires: libpcsclite1 >= %{version}
BuildRoot: %{_tmppath}/%{name}-%{version}-build
@@ -125,16 +118,11 @@ Authors:
%prep
%setup -q
# Ensure that Apple Public Source License Version 1.1 does not apply:
cp -a %{S:1} %{S:2} .
%patch
%patch1
%patch2 -p2
%patch3
%patch4 -p2
%build
%if %suse_version > 1010
%if %suse_version > 1110
ACLOCAL="aclocal -I m4" autoreconf -f -i
%endif
%configure\