[Pcsclite-cvs-commit] CVS PCSC/src
CVS User rousseau
ludovic.rousseau@free.fr
Tue, 14 Sep 2004 01:09:07 -0600
Update of /cvsroot/pcsclite/PCSC/src
In directory haydn:/tmp/cvs-serv13996
Modified Files:
eventhandler.c readerfactory.c tokenfactory.c
Log Message:
use strlcpy() instead of strcpy()
--- /cvsroot/pcsclite/PCSC/src/eventhandler.c 2004/09/11 18:31:39 1.29
+++ /cvsroot/pcsclite/PCSC/src/eventhandler.c 2004/09/14 07:09:07 1.30
@@ -9,7 +9,7 @@
* Copyright (C) 2004
* Ludovic Rousseau <ludovic.rousseau@free.fr>
*
- * $Id: eventhandler.c,v 1.29 2004/09/11 18:31:39 rousseau Exp $
+ * $Id: eventhandler.c,v 1.30 2004/09/14 07:09:07 rousseau Exp $
*/
#include "config.h"
@@ -30,6 +30,7 @@
#include "sys_generic.h"
#include "ifdwrapper.h"
#include "prothandler.h"
+#include "strlcpycat.h"
static PREADER_STATE readerStates[PCSCLITE_MAX_READERS_CONTEXTS];
@@ -178,7 +179,8 @@
* Set all the attributes to this reader
*/
rContext->readerState = readerStates[i];
- strcpy(rContext->readerState->readerName, rContext->lpcReader);
+ strlcpy(rContext->readerState->readerName, rContext->lpcReader,
+ sizeof(rContext->readerState->readerName));
memcpy(rContext->readerState->cardAtr, ucAtr, dwAtrLen);
rContext->readerState->readerID = i + 100;
rContext->readerState->readerState = dwStatus;
--- /cvsroot/pcsclite/PCSC/src/readerfactory.c 2004/09/11 18:26:07 1.64
+++ /cvsroot/pcsclite/PCSC/src/readerfactory.c 2004/09/14 07:09:07 1.65
@@ -8,7 +8,7 @@
* Damien Sauveron <damien.sauveron@labri.fr>
* Ludovic Rousseau <ludovic.rousseau@free.fr>
*
- * $Id: readerfactory.c,v 1.64 2004/09/11 18:26:07 rousseau Exp $
+ * $Id: readerfactory.c,v 1.65 2004/09/14 07:09:07 rousseau Exp $
*/
#include "config.h"
@@ -31,6 +31,7 @@
#include "eventhandler.h"
#include "ifdwrapper.h"
#include "hotplug.h"
+#include "strlcpycat.h"
#ifndef TRUE
#define TRUE 1
@@ -124,8 +125,10 @@
parentNode = RFSetReaderName(sReadersContexts[dwContext], lpcReader,
lpcLibrary, dwPort, 0);
- strcpy((sReadersContexts[dwContext])->lpcLibrary, lpcLibrary);
- strcpy((sReadersContexts[dwContext])->lpcDevice, lpcDevice);
+ strlcpy((sReadersContexts[dwContext])->lpcLibrary, lpcLibrary,
+ sizeof((sReadersContexts[dwContext])->lpcLibrary));
+ strlcpy((sReadersContexts[dwContext])->lpcDevice, lpcDevice,
+ sizeof((sReadersContexts[dwContext])->lpcDevice));
(sReadersContexts[dwContext])->dwVersion = 0;
(sReadersContexts[dwContext])->dwPort = dwPort;
(sReadersContexts[dwContext])->mMutex = 0;
@@ -316,11 +319,14 @@
* Copy the previous reader name and increment the slot number
*/
tmpReader = sReadersContexts[dwContextB]->lpcReader;
- strcpy(tmpReader, sReadersContexts[dwContext]->lpcReader);
+ strlcpy(tmpReader, sReadersContexts[dwContext]->lpcReader,
+ sizeof(sReadersContexts[dwContextB]->lpcReader));
sprintf(tmpReader + strlen(tmpReader) - 2, "%02X", j);
- strcpy((sReadersContexts[dwContextB])->lpcLibrary, lpcLibrary);
- strcpy((sReadersContexts[dwContextB])->lpcDevice, lpcDevice);
+ strlcpy((sReadersContexts[dwContextB])->lpcLibrary, lpcLibrary,
+ sizeof((sReadersContexts[dwContextB])->lpcLibrary));
+ strlcpy((sReadersContexts[dwContextB])->lpcDevice, lpcDevice,
+ sizeof((sReadersContexts[dwContextB])->lpcDevice));
(sReadersContexts[dwContextB])->dwVersion =
(sReadersContexts[dwContext])->dwVersion;
(sReadersContexts[dwContextB])->dwPort =
--- /cvsroot/pcsclite/PCSC/src/tokenfactory.c 2004/08/06 12:12:20 1.24
+++ /cvsroot/pcsclite/PCSC/src/tokenfactory.c 2004/09/14 07:09:07 1.25
@@ -8,7 +8,7 @@
* Copyright (C) 2004
* Ludovic Rousseau <ludovic.rousseau@free.fr>
*
- * $Id: tokenfactory.c,v 1.24 2004/08/06 12:12:20 rousseau Exp $
+ * $Id: tokenfactory.c,v 1.25 2004/09/14 07:09:07 rousseau Exp $
*/
#include "config.h"
@@ -24,6 +24,7 @@
#include "parser.h"
#include "dyn_generic.h"
#include "tokenfactory.h"
+#include "strlcpycat.h"
#ifndef WIN32
#ifndef MSC_SVC_DROPDIR
@@ -239,7 +240,8 @@
#ifndef NO_MSC_DEBUG
DebugLogB("Product name: %s", keyValue);
#endif
- strcpy(tokenInfo->tokenName, keyValue);
+ strlcpy(tokenInfo->tokenName, keyValue,
+ sizeof(tokenInfo->tokenName));
/*
* See if this bundle has a special driver for this card
@@ -280,7 +282,8 @@
/*
* Copy the library path and return successfully
*/
- strcpy(tokenInfo->svProvider, fullLibPath);
+ strlcpy(tokenInfo->svProvider, fullLibPath,
+ sizeof(tokenInfo->svProvider));
/*
* See if this bundle has a default AID